New android Support Design Library, scroll tablayout offscreen not working -
trying use new support design library. in layout want toolbar
stay @ top of screen, have tablayout
go off screen when user scrolls down. looks viewpager
goes underneath appbarlayout
. used blog post reference https://medium.com/ribot-labs/exploring-the-new-android-design-support-library-b7cda56d2c32
this layout, within viewpager
holds fragments
consist of recycler views
<?xml version="1.0" encoding="utf-8"?> <relativelayout 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:background="@color/material_grey50" android:clickable="true"> <android.support.design.widget.coordinatorlayout android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.v4.view.viewpager android:id="@+id/pager" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/tablayout" /> <android.support.design.widget.appbarlayout android:layout_width="match_parent" android:layout_height="wrap_content"> <android.support.v7.widget.toolbar android:id="@+id/toolbar_list" android:layout_width="match_parent" android:layout_height="?attr/actionbarsize" android:background="?attr/colorprimary" android:theme="@style/themeoverlay.appcompat.dark.actionbar" app:popuptheme="@style/themeoverlay.appcompat.light" /> <android.support.design.widget.tablayout android:id="@+id/tablayout" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/toolbar_list" android:background="?attr/colorprimary" android:scrollbars="horizontal" android:theme="@style/themeoverlay.appcompat.dark.actionbar" app:layout_scrollflags="scroll|enteralways" app:tabgravity="center" /> </android.support.design.widget.appbarlayout> <android.support.design.widget.floatingactionbutton android:id="@+id/fab_post" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentbottom="true" android:layout_alignparentright="true" android:layout_gravity="bottom|right" android:layout_marginbottom="16dp" android:layout_marginright="16dp" android:elevation="3dp" android:src="@drawable/ic_videocam_white_36dp" app:backgroundtint="@color/accent" app:fabsize="normal" /> </android.support.design.widget.coordinatorlayout>
don't forget set in viewpager:
app:layout_behavior="@string/appbar_scrolling_view_behavior"
Comments
Post a Comment