Hide android toolbar on scroll of CoordinatorLayout but keep TabLayout fixed -
i have following layout file activity_main.xml
:
<?xml version="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" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <android.support.design.widget.appbarlayout android:id="@+id/appbarlayout" android:layout_width="match_parent" android:layout_height="wrap_content"> <android.support.v7.widget.toolbar android:id="@+id/my_toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionbarsize" android:background="?attr/colorprimary" android:elevation="4dp" app:contentinsetend="0dp" app:contentinsetstart="0dp" app:layout_scrollflags="scroll|enteralways" app:popuptheme="@style/themeoverlay.appcompat.light"> <imageview android:id="@+id/toolbar_icon_image_view" android:layout_width="wrap_content" android:layout_height="match_parent" android:adjustviewbounds="true" android:paddingbottom="7dp" android:paddingleft="5dp" android:paddingtop="7dp" android:scaletype="centerinside" android:src="@drawable/toolbar_icon"/> </android.support.v7.widget.toolbar> </android.support.design.widget.appbarlayout> <android.support.v4.widget.drawerlayout android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior"> <android.support.v4.widget.swiperefreshlayout android:id="@+id/swiperefreshlayout" android:layout_width="match_parent" android:layout_height="match_parent"> <relativelayout android:id="@+id/main_grid_layout" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.v4.view.viewpager android:id="@+id/content_pager" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_above="@+id/sliding_tabs"/> <com.ili.view.slidingtablayout android:id="@+id/sliding_tabs" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignparentbottom="true"/> </relativelayout> </android.support.v4.widget.swiperefreshlayout> <!-- navigation drawer --> <listview android:id="@+id/left_drawer" android:layout_width="275dp" android:layout_height="match_parent" android:layout_gravity="left" android:choicemode="singlechoice" android:descendantfocusability="beforedescendants"/> </android.support.v4.widget.drawerlayout </android.support.design.widget.coordinatorlayout>
expected behavior:
i latter show when open app, , toolbar hide upon scrolling.
but activity_main.xml
getting following behavior:
and after scrolling down, toolbar hides(as expected) , slidingtablayout
shows. tab layout remain fixed below view pager.
now know may because i'm setting behavior of whole drawer layout app:layout_behavior="@string/appbar_scrolling_view_behavior"
, tried separate slidingtablayout
, put outside drawer layout , worked expected, except slidingtablayout
stayed on last row of list in viewpager
, since in coordinatorlayout
cannot tell drawerlayout
remain on top of slidingtablayout
.
so knows how can make toolbar hide upon scrolling slidingtablayout
remain fixed , not hide last row of list?
Comments
Post a Comment