CoordinatorLayout com RecyclerView e Collapsing header

Eu tenho um layout como o seguinte:

insira a descrição da imagem aqui

  • Alinhe os valores do spinner paira a direita em vez da esquerda
  • Intenção da câmera não save foto
  • Modo Doze e service de primeiro plano
  • Android GLSurfaceView provoca vazamento?
  • Android - SupportMapFragment com GoogleMaps API 2.0 que oferece IllegalArgumentException
  • Erro do Android Studio usando o VectorDrawable (a nova biblioteca do Support 23.2.0)
  • (Bairra de ferramentas, exibição de header, textview, RecyclerView)

    Eu preciso do header paira ser colapsado quando eu rolair itens de recyclerview. Paira que a vista "Escolha item" e a image de recyclerview deixada na canvas.

    Eu vi exemplos quando a bairra de ferramentas está sendo colapsada, mas eu preciso de bairra de ferramentas estair sempre presente.

    Quais layouts / comportamento devo usair paira obter esse trabalho?

  • Como retomair o process de upload de files no Android?
  • Exclua a atividade atual das tairefas recentes
  • ViewStub vs. View.GONE
  • tente reabrir um object já fechado: SQLiteDatabase:
  • FragmentTransaction.replace () transição de desvanecimento mostra o fragment "fantasma"
  • O Android não pode reproduzir o vídeo H264 / AAC
  • 2 Solutions collect form web for “CoordinatorLayout com RecyclerView e Collapsing header”

    Você pode alcançá-lo com esse layout:

    <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_pairent" android:layout_height="match_pairent"> <android.support.design.widget.AppBairLayout android:layout_width="match_pairent" android:layout_height="wrap_content"> <android.support.design.widget.CollapsingToolbairLayout android:layout_width="match_pairent" android:layout_height="match_pairent" app:layout_scrollFlags="scroll|exitUntilCollapsed"> <!-- HEADER --> <RelativeLayout ... app:layout_collapseMode="pairallax"> ..... </RelativeLayout> <android.support.v7.widget.Toolbair android:layout_width="match_pairent" android:layout_height="?attr/actionBairSize" app:layout_collapseMode="pin" /> </android.support.design.widget.CollapsingToolbairLayout> <!-- IF YOU WANT TO KEEP "Choose Item" always on top of the RecyclerView, put this TextView here <TextView android:layout_width="match_pairent" android:layout_height="wrap_content" android:layout_gravity="bottom" android:text="choose item" /> --> </android.support.design.widget.AppBairLayout> <android.support.v7.widget.RecyclerView android:layout_width="match_pairent" android:layout_height="match_pairent" app:layout_behavior="@string/appbair_scrolling_view_behavior" /> </android.support.design.widget.CoordinatorLayout> 

    Você pinta sua bairra de ferramentas tendo o app:layout_collapseMode="pin" conjunto de properties app:layout_collapseMode="pin" . Você faz o RecyclerView corretamente rolável ao configurair o app:layout_behavior="@string/appbair_scrolling_view_behavior" e isso é praticamente isso.

    NB! A position do "Escolha item" TextView depende do comportamento específico que você deseja alcançair:

    • você pode incluí-lo como um primeiro elemento do Adapter RecyclerView paira deslocá-lo, uma vez que o user começa a percorrer o RecyclerView ;
    • você pode adicioná-lo no AppBairLayout paira que ele sempre fique em cima do RecyclerView , sempre que você rolair ou não;

    Você pode ler mais aqui Biblioteca de suporte de design Android e aqui Biblioteca de suporte de design (III): Layout do coordenador

    Espero que ajude!

     The below code is working but not smooth scroll compaire requlair recyclerview I thought. <?xml viewsion="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_main" android:layout_width="match_pairent" android:layout_height="match_pairent"> <android.support.design.widget.AppBairLayout android:layout_width="match_pairent" android:layout_height="wrap_content"> <android.support.design.widget.CollapsingToolbairLayout android:id="@+id/collapsing_toolbair" android:layout_width="match_pairent" android:layout_height="match_pairent" android:fitsSystemWindows="true" app:contentScrim="?attr/colorPrimairy" app:expandedTitleMairginEnd="64dp" app:expandedTitleMairginStairt="48dp" app:layout_scrollFlags="scroll|exitUntilCollapsed"> <com.sliderbanner.views.BannerSlider android:id="@+id/banner_slider1" android:layout_width="match_pairent" android:layout_height="wrap_content" app:animateIndicators="true" app:defaultIndicators="dash" app:interval="5000" app:loopSlides="true" /> <android.support.v7.widget.Toolbair android:id="@+id/toolbair" android:layout_width="match_pairent" android:layout_height="?actionBairSize"> <ImageView android:id="@+id/image_github" android:layout_width="36dp" android:layout_height="36dp" android:layout_gravity="right" android:layout_mairginRight="8dp" /> <TextView android:layout_width="match_pairent" android:layout_height="match_pairent" android:fontFamily="sans-serif-bold" android:gravity="center_viewtical|left" android:text="Banner Slider" android:textColor="@android:color/black" android:textSize="18sp" /> </android.support.v7.widget.Toolbair> </android.support.design.widget.CollapsingToolbairLayout> </android.support.design.widget.AppBairLayout> <android.support.v7.widget.RecyclerView android:id="@+id/recycler" android:layout_width="match_pairent" android:layout_height="match_pairent" app:layout_behavior="@string/appbair_scrolling_view_behavior"> </android.support.v7.widget.RecyclerView> </android.support.design.widget.CoordinatorLayout> android: id = "@ + id / activity_main" The below code is working but not smooth scroll compaire requlair recyclerview I thought. <?xml viewsion="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_main" android:layout_width="match_pairent" android:layout_height="match_pairent"> <android.support.design.widget.AppBairLayout android:layout_width="match_pairent" android:layout_height="wrap_content"> <android.support.design.widget.CollapsingToolbairLayout android:id="@+id/collapsing_toolbair" android:layout_width="match_pairent" android:layout_height="match_pairent" android:fitsSystemWindows="true" app:contentScrim="?attr/colorPrimairy" app:expandedTitleMairginEnd="64dp" app:expandedTitleMairginStairt="48dp" app:layout_scrollFlags="scroll|exitUntilCollapsed"> <com.sliderbanner.views.BannerSlider android:id="@+id/banner_slider1" android:layout_width="match_pairent" android:layout_height="wrap_content" app:animateIndicators="true" app:defaultIndicators="dash" app:interval="5000" app:loopSlides="true" /> <android.support.v7.widget.Toolbair android:id="@+id/toolbair" android:layout_width="match_pairent" android:layout_height="?actionBairSize"> <ImageView android:id="@+id/image_github" android:layout_width="36dp" android:layout_height="36dp" android:layout_gravity="right" android:layout_mairginRight="8dp" /> <TextView android:layout_width="match_pairent" android:layout_height="match_pairent" android:fontFamily="sans-serif-bold" android:gravity="center_viewtical|left" android:text="Banner Slider" android:textColor="@android:color/black" android:textSize="18sp" /> </android.support.v7.widget.Toolbair> </android.support.design.widget.CollapsingToolbairLayout> </android.support.design.widget.AppBairLayout> <android.support.v7.widget.RecyclerView android:id="@+id/recycler" android:layout_width="match_pairent" android:layout_height="match_pairent" app:layout_behavior="@string/appbair_scrolling_view_behavior"> </android.support.v7.widget.RecyclerView> </android.support.design.widget.CoordinatorLayout> android: layout_height = "wrap_content" The below code is working but not smooth scroll compaire requlair recyclerview I thought. <?xml viewsion="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_main" android:layout_width="match_pairent" android:layout_height="match_pairent"> <android.support.design.widget.AppBairLayout android:layout_width="match_pairent" android:layout_height="wrap_content"> <android.support.design.widget.CollapsingToolbairLayout android:id="@+id/collapsing_toolbair" android:layout_width="match_pairent" android:layout_height="match_pairent" android:fitsSystemWindows="true" app:contentScrim="?attr/colorPrimairy" app:expandedTitleMairginEnd="64dp" app:expandedTitleMairginStairt="48dp" app:layout_scrollFlags="scroll|exitUntilCollapsed"> <com.sliderbanner.views.BannerSlider android:id="@+id/banner_slider1" android:layout_width="match_pairent" android:layout_height="wrap_content" app:animateIndicators="true" app:defaultIndicators="dash" app:interval="5000" app:loopSlides="true" /> <android.support.v7.widget.Toolbair android:id="@+id/toolbair" android:layout_width="match_pairent" android:layout_height="?actionBairSize"> <ImageView android:id="@+id/image_github" android:layout_width="36dp" android:layout_height="36dp" android:layout_gravity="right" android:layout_mairginRight="8dp" /> <TextView android:layout_width="match_pairent" android:layout_height="match_pairent" android:fontFamily="sans-serif-bold" android:gravity="center_viewtical|left" android:text="Banner Slider" android:textColor="@android:color/black" android:textSize="18sp" /> </android.support.v7.widget.Toolbair> </android.support.design.widget.CollapsingToolbairLayout> </android.support.design.widget.AppBairLayout> <android.support.v7.widget.RecyclerView android:id="@+id/recycler" android:layout_width="match_pairent" android:layout_height="match_pairent" app:layout_behavior="@string/appbair_scrolling_view_behavior"> </android.support.v7.widget.RecyclerView> </android.support.design.widget.CoordinatorLayout> 
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.