android - AppBarLayout not collapsing during programmatically scroll -
i have viewpager fragments containe recyclerviews. collapsingtollbarlayout above viewpager. everythings works fine except during programmatically scroll on recyclerview. appbarlayout or collapsingtoolbarlayout doesn't responde.
here base layout 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:id="@+id/coordinatorlayout" android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true"> <android.support.design.widget.appbarlayout android:id="@+id/appbarlayout" android:layout_width="match_parent" android:layout_height="256dp" android:fitssystemwindows="true" android:theme="@style/themeoverlay.appcompat.dark.actionbar" app:layout_behavior="de.wackernagel.playball.ui.flingbehaviour"> <android.support.design.widget.collapsingtoolbarlayout android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true" android:id="@+id/collapsingtoolbarlayout" app:contentscrim="?attr/colorprimary" app:titleenabled="false" app:layout_scrollflags="scroll|exituntilcollapsed"> <imageview android:contentdescription="@null" android:layout_width="match_parent" android:layout_height="match_parent" android:scaletype="centercrop" android:src="@drawable/showdown" app:layout_collapsemode="parallax"/> <android.support.v7.widget.toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="@dimen/doubleactionbarsize" android:minheight="?attr/actionbarsize" android:gravity="top" app:titlemargintop="14dp" app:layout_collapsemode="pin" app:popuptheme="@style/themeoverlay.appcompat.light"/> <android.support.design.widget.tablayout android:id="@+id/tablayout" android:layout_width="match_parent" android:layout_height="?attr/actionbarsize" android:background="@android:color/transparent" android:layout_gravity="bottom" app:tabtextcolor="#beffffff" app:tabselectedtextcolor="#ffffffff" app:tabcontentstart="@dimen/keyline_2" app:tabmode="scrollable" /> </android.support.design.widget.collapsingtoolbarlayout> </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"/>
my goal collapse collapsingtoolbarlayout during programmatically scroll normal touch scroll.
i by
activity fragment @ current viewpager position fragment layoutmanager recyclerview layoutmanager scrolltoposition x
the scrolling behavior works on recyclerview collapsingtoolbarlayout doesn't responde.
edit
here layout of fragments:
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <de.wackernagel.playball.views.emptyawarerecyclerview android:id="@+id/recyclerview" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingbottom="8dp" /> <textview android:id="@android:id/empty" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center"/>
<android.support.v4.view.viewpager android:id="@+id/htab_viewpager" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior" /> <android.support.design.widget.appbarlayout android:id="@+id/htab_appbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:fitssystemwindows="true" app:layout_behavior="example.com.final.tabparallax.flingbehavior" android:theme="@style/themeoverlay.appcompat.dark.actionbar"> <android.support.design.widget.collapsingtoolbarlayout android:id="@+id/htab_collapse_toolbar" android:layout_width="match_parent" android:layout_height="360dp" android:fitssystemwindows="true" app:contentscrim="?attr/colorprimary" app:layout_scrollflags="scroll|exituntilcollapsed"> <framelayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:padding="0dp"> <imageview android:id="@+id/htab_header" android:layout_width="match_parent" android:layout_height="359dp" android:background="@drawable/channel" android:fitssystemwindows="true" android:scaletype="centercrop" app:layout_collapsemode="parallax" /> </framelayout> </android.support.design.widget.collapsingtoolbarlayout> <android.support.design.widget.tablayout android:id="@+id/htab_tabs" android:layout_width="match_parent" android:layout_height="?attr/actionbarsize" android:background="@color/coloraccent1" android:fitssystemwindows="true" android:gravity="bottom" app:tabgravity="center" app:tabindicatorcolor="@android:color/white" app:tabmode="scrollable" app:tabselectedtextcolor="@android:color/white" app:tabtextcolor="@android:color/white" /> </android.support.design.widget.appbarlayout>
Comments
Post a Comment