I need to create a GUI with a ListView
and an ActionBar
which will hide when scrolling down and when scrolling up it must reappear.
The following guides didn't help me:
I need something like this:
If you would like to obtain a list with this behaviour, you should:
compile 'com.android.support:design:22.2.0'
CoordinatorLayout
with a Toolbar where you have to define app:layout_scrollFlags="scroll|enterAlways"
RecyclerView
instead of a ListView
. As described here ListView
and the GridView
have the expected behavior with the CoordinatorLayout
only with API>21. In this case you have to use setNestedScrollingEnabled(true);
The official blog post shows this case:
<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"> <! -- Your Scrollable View --> <android.support.v7.widget.RecyclerView android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior" /> <android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <android.support.v7.widget.Toolbar ... app:layout_scrollFlags="scroll|enterAlways"> </android.support.design.widget.AppBarLayout> </android.support.design.widget.CoordinatorLayout>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With