android - Recycler View Scrolling do not collapse tablayout, toolbar and ImageView -
my recycler view has 4 items , when scroll toolbar, image , tablayout should collapse. dont. when touch tablayout or imageview , scroll collapse. recyclerview collapse above mentioned view , dont. when fling dont. when scroll recyclerview collapse views. have checked many blogs , tried different scroll_flags , combination. tried setnestedscroll(true) recyclerview.
<?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.drawerlayout 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/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true" tools:opendrawer="start"> <android.support.design.widget.coordinatorlayout android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true"> <android.support.design.widget.appbarlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:fitssystemwindows="true" android:theme="@style/themeoverlay.appcompat.dark.actionbar"> <android.support.design.widget.collapsingtoolbarlayout android:id="@+id/collapse_toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:fitssystemwindows="true" app:contentscrim="?attr/colorprimary" app:expandedtitlemarginend="64dp" app:expandedtitlemarginstart="48dp" app:layout_scrollflags="scroll|exituntilcollapsed" app:titleenabled="false"> <imageview android:layout_width="match_parent" android:layout_height="wrap_content" android:minheight="100dp" android:scaletype="centercrop" android:src="@drawable/banner_android" app:layout_collapsemode="parallax" app:layout_scrollflags="scroll|enteralways|enteralwayscollapsed" /> <android.support.v7.widget.toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionbarsize" android:layout_gravity="top" android:background="?attr/colorprimary" android:elevation="4dp" android:theme="@style/themeoverlay.appcompat.actionbar" android:titletextcolor="@android:color/white" app:layout_collapsemode="pin" app:layout_scrollflags="scroll|enteralways" app:popuptheme="@style/themeoverlay.appcompat.light" /> </android.support.design.widget.collapsingtoolbarlayout> <android.support.design.widget.tablayout android:id="@+id/tabs" style="@style/mycustomtablayout" android:layout_width="wrap_content" android:layout_height="?attr/actionbarsize" android:layout_gravity="bottom" android:elevation="6dp" app:tabgravity="center" app:layout_scrollflags="scroll|enteralways" app:tabindicatorcolor="@android:color/transparent" app:tabmode="scrollable" app:tabpaddingend="10dp" app:tabpaddingstart="10dp" /> <!--app:tabtextappearance="@style/minecustomtabtext"--> </android.support.design.widget.appbarlayout> <android.support.v7.widget.recyclerview android:id="@+id/recyclerview3" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior"></android.support.v7.widget.recyclerview> </android.support.design.widget.coordinatorlayout> <android.support.design.widget.navigationview android:id="@+id/nav_view" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="start" android:fitssystemwindows="true" app:headerlayout="@layout/nev_header_main" app:menu="@menu/activity_main_drawer" />
you can shown below
<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:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true""> <android.support.design.widget.appbarlayout android:id="@+id/appbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/apptheme.noactionbar.appbaroverlay"> <android.support.design.widget.collapsingtoolbarlayout android:id="@+id/collapsing_toolbar" android:layout_width="match_parent" android:layout_height="200dp" android:fitssystemwindows="true" app:contentscrim="?attr/colorprimary" app:expandedtitlemarginstart="48dp" app:expandedtitletextappearance="@style/textappearance.appcompat.headline" app:layout_scrollflags="scroll|exituntilcollapsed"> <imageview android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true" app:layout_collapsemode="parallax" /> <android.support.v7.widget.toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionbarsize" app:contentinsetstart="48dp" app:layout_collapsemode="pin" app:popuptheme="@style/themeoverlay.appcompat.light"/> </android.support.design.widget.collapsingtoolbarlayout> <android.support.design.widget.tablayout android:id="@+id/tabs" android:layout_width="match_parent" android:layout_height="?attr/actionbarsize" android:layout_gravity="bottom" android:background="?attr/colorprimary" app:tabindicatorcolor="@android:color/white"/> </android.support.design.widget.appbarlayout> <relativelayout android:id="@+id/content_main2" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior"> <android.support.v4.view.viewpager android:id="@+id/viewpager" android:layout_width="match_parent" android:layout_height="match_parent" /> </relativelayout> <android.support.design.widget.floatingactionbutton android:id="@+id/fab" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|end" android:layout_margin="@dimen/fab_margin" app:srccompat="@android:drawable/ic_dialog_email"/> </android.support.design.widget.coordinatorlayout>
Comments
Post a Comment