Collapsible Toolbar Android -


i try implement collapsible toolbar feature in app. followed instructions - wrapped in coordinator layout, used appbarlayout toolbar doesn't collapse on scroll...

my layout code:

     <android.support.design.widget.coordinatorlayout         xmlns:android="http://schemas.android.com/apk/res/android"        xmlns:tools="http://schemas.android.com/tools"        xmlns:app="http://schemas.android.com/apk/lib/com.app.chasebank"        android:id="@+id/main_content"        android:layout_width="match_parent"        android:layout_height="match_parent"        android:fitssystemwindows="true"        tools:context=".additemsactivity">             <android.support.v7.widget.recyclerview               xmlns:android="http://schemas.android.com/apk/res/android"               xmlns:tools="http://schemas.android.com/tools"               android:id="@+id/recyclerview"               android:layout_width="match_parent"               android:layout_height="match_parent"               android:layout_margintop="20dp"               app:layout_behavior="@string/appbar_scrolling_view_behavior">           </android.support.v7.widget.recyclerview>          <android.support.design.widget.appbarlayout         android:layout_width="match_parent"         android:layout_height="180dp"         android:theme="@style/themeoverlay.appcompat.dark">            <android.support.design.widget.collapsingtoolbarlayout            android:id="@+id/collapse_toolbar"            android:layout_width="match_parent"            android:layout_height="match_parent"            app:layout_scrollflags ="scroll|exituntilcollapsed">              <android.support.v7.widget.toolbar              android:id="@+id/toolbar"              android:layout_width="match_parent"              android:layout_height="?attr/actionbarsize"              app:layout_scrollflags="scroll|enteralways" />      </android.support.design.widget.collapsingtoolbarlayout> </android.support.design.widget.appbarlayout> 

and activity code looks this:

    toolbar = (toolbar) findviewbyid(r.id.toolbar);     setsupportactionbar(toolbar);     getsupportactionbar().setdisplayhomeasupenabled(true);     collapsingtoolbarlayout collapsingtoolbar =(collapsingtoolbarlayout)findviewbyid(r.id.collapse_toolbar);     collapsingtoolbar.settitle("buy"); 

i don't understand - why doesn't collapse , looks "pinned" on screen... appreciate advice/ help!

put recyclerview after appbarlayout


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo