android - CollapsingToolbarLayout not working(collapsing)when scrolled -
i trying create collapsingtoolbarlayout
, below listview, when listview scrolled toolbar should collapse, not working when scrolled toolbar not collapsing.
used tutorial: http://android-developers.blogspot.in/2015_05_01_archive.html
note: framelayout contains listview
<linearlayout 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="wrap_content" android:orientation="vertical" android:scrollbars="vertical"> <android.support.design.widget.appbarlayout android:id="@+id/appbar" android:layout_width="match_parent" android:layout_height="192dp" android:theme="@style/themeoverlay.appcompat.dark.actionbar"> <android.support.design.widget.collapsingtoolbarlayout android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_scrollflags="scroll|exituntilcollapsed"> <android.support.v7.widget.toolbar android:id="@+id/toolbara" android:layout_width="match_parent" android:layout_height="?attr/actionbarsize" android:background="?attr/colorprimary" app:layout_collapsemode="pin" app:popuptheme="@style/themeoverlay.appcompat.light" /> </android.support.design.widget.collapsingtoolbarlayout> </android.support.design.widget.appbarlayout> <framelayout android:id="@+id/frame" android:layout_width="match_parent" android:layout_height="wrap_content" /> </linearlayout>
the framelayout code:
<relativelayout 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:layout_width="match_parent" android:layout_height="match_parent" tools:context="ranjithnair02.com.supporttest.blankfragment"> <listview android:id="@+id/rcyv" android:layout_width="match_parent" android:layout_height="match_parent" /> <android.support.design.widget.floatingactionbutton android:id="@+id/fab" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentbottom="true" android:layout_alignparentright="true" android:layout_marginbottom="10dp" android:layout_marginright="10dp" android:src="@android:drawable/ic_search_category_default" app:borderwidth="0dp" app:elevation="5dp" app:ripplecolor="@color/wallet_highlighted_text_holo_light" /> </relativelayout>
you should use recyclerview instead of listview
note: don't forget update recyclerview in gradle file.
compile 'com.android.support:recyclerview-v7:22.2.0'
Comments
Post a Comment