android - How to make RecyclerView fix header when scrolling -
i have recyclerview
has been filled data. it's when scroll, header not fix toolbar position , results go up.
how hide toolbar header when scrolling? or more create fixed scroll on recyclerview when scrolling?
all code runs well, it's problem header goes when scroll
activitymain layout :
<?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" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/main_content" android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true" tools:context="com.bertho.gmyl.mainactivity"> <android.support.design.widget.appbarlayout android:id="@+id/appbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingtop="@dimen/appbar_padding_top" android:theme="@style/apptheme.appbaroverlay"> <android.support.v7.widget.toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionbarsize" android:background="?attr/colorprimary" app:layout_scrollflags="scroll|enteralways" app:popuptheme="@style/apptheme.popupoverlay"> </android.support.v7.widget.toolbar> <android.support.design.widget.tablayout android:id="@+id/tabs" app:tabbackground="@drawable/tab_selector" app:tabindicatorcolor="@color/whitecolor" android:layout_width="match_parent" android:layout_height="wrap_content" /> </android.support.design.widget.appbarlayout> <android.support.v4.view.viewpager android:id="@+id/viewpager" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior" /> <android.support.design.widget.floatingactionbutton android:id="@+id/fab" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="end|bottom" android:layout_margin="@dimen/fab_margin" app:srccompat="@android:drawable/ic_dialog_email" /> </android.support.design.widget.coordinatorlayout>
recyclerview layout :
<?xml version="1.0" encoding="utf-8"?> <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="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior"> <android.support.v7.widget.recyclerview android:id="@+id/rvarticle" android:layout_width="match_parent" android:layout_height="wrap_content" /> </linearlayout>
try setting android:fitssystemwindows="false"
takes entire screen (including status bar) draw activity.
for more info.
Comments
Post a Comment