Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to create CollapsingToolbarLayout with using Recyclerview

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 5.96k
    Comment on it

     In the below example layout I have created CollapsingToolbarLayout with using Recyclerview. Here first I have created CoordinatorLayout created all layout in CoordinatorLayout. Now I have added AppBarLayout, CollapsingToolbarLayout, ImageView, Toolbar, RecyclerView and FloatingActionButton. You can see below program it will clearly describe how to create CollapsingToolbarLayout with using Recyclerview.

    <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_parent"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true">
        <android.support.design.widget.AppBarLayout
            android:id="@+id/app_bar_layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:fitsSystemWindows="true"
            android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
    
            <android.support.design.widget.CollapsingToolbarLayout
                android:id="@+id/collapsing_toolbar"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:fitsSystemWindows="true"
                app:contentScrim="?attr/colorPrimary"
                app:layout_scrollFlags="scroll|exitUntilCollapsed">
                <ImageView
                    android:id="@+id/image"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:fitsSystemWindows="true"
                    android:scaleType="centerCrop"
                    android:src="@drawable/img1"
                    app:layout_collapseMode="parallax" />
                <android.support.v7.widget.Toolbar
                    android:id="@+id/toolbar"
                    android:layout_width="match_parent"
                    android:layout_height="?attr/actionBarSize"
                    android:popupTheme="@style/ThemeOverlay.AppCompat.Dark"
                    android:title="Collapsing Toolbar"
                    app:layout_collapseMode="pin" />
    
                </android.support.design.widget.CollapsingToolbarLayout>
    
            </android.support.design.widget.AppBarLayout>
    
                 <android.support.v7.widget.RecyclerView
                    android:id="@+id/recyclerView"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    app:layout_behavior="@string/appbar_scrolling_view_behavior">
                 </android.support.v7.widget.RecyclerView>
    
            <android.support.design.widget.FloatingActionButton
                  android:id="@+id/fab"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_margin="16dp"
                  android:clickable="true"
                  android:src="@drawable/two"
                  app:layout_anchor="@id/recyclerView"
                  app:layout_anchorGravity="bottom|right|end" />
    
    
    </android.support.design.widget.CoordinatorLayout>
    

     

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: