android - app:layout_scrollFlags="scroll|enterAlways" doesn't works with LinearLayout -
i have start working on android material design support library, , newbie have confusions. and, need help. :)
1) possible use layout_scrollflags="scroll|enteralways"
linearlayout?
2) want linearlayout below toolbar. achieved using appbarlayout, want scroll linearlayout not toolbar on scrolling content below linearlayout. using layout_scrollflags="scroll|enteralways"
on linearlayout doesn't works.
3) can use more 1 appbarlayout in coordinatorlayout , toolbar in appbarlayout?
<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:layout_width="match_parent" android:layout_height="wrap_content" 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:popuptheme="@style/apptheme.popupoverlay" /> <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:padding="10dp" app:layout_scrollflags="scroll|enteralways"> <textview android:layout_width="match_parent" android:layout_height="wrap_content" android:text="textview : 1 " /> <textview android:layout_width="match_parent" android:layout_height="wrap_content" android:text="textview : 2" /> <textview android:layout_width="match_parent" android:layout_height="wrap_content" android:text="textview : 3" /> <textview android:layout_width="match_parent" android:layout_height="wrap_content" android:text="textview : 4" /> <textview android:layout_width="match_parent" android:layout_height="wrap_content" android:text="textview : 5" /> <textview android:layout_width="match_parent" android:layout_height="wrap_content" android:text="textview : 6" /> <textview android:layout_width="match_parent" android:layout_height="wrap_content" android:text="textview : 7" /> </linearlayout> </android.support.design.widget.appbarlayout> <android.support.v7.widget.recyclerview android:id="@+id/list" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior" /> </android.support.design.widget.coordinatorlayout>
after implementing saravinfern's solution, here achieved far...
1.scroll flags won't work on container unless component designed so. specific components appbarlayout designed that.
2.do want hide linearlayout after scrolling , show toolbar??
3.as far know better have 1 appbarlayout, if use multiple appbar layout, may lead scrolling problems
update 2 this
<android.support.design.widget.appbarlayout android:id="@+id/app_bar" android:layout_width="match_parent" android:layout_height="@dimen/app_bar_height" android:fitssystemwindows="true" android:theme="@style/apptheme.appbaroverlay"> <android.support.design.widget.collapsingtoolbarlayout android:id="@+id/toolbar_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true" app:contentscrim="?attr/colorprimary" app:layout_scrollflags="scroll|exituntilcollapsed> <relativelayout android:layout_width="match_parent" android:layout_height="wrap_content"> <android.support.v7.widget.toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionbarsize" app:layout_collapsemode="pin" app:popuptheme="@style/apptheme.popupoverlay" /> <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:padding="10dp" android:layout_below="@+id/toolbar" android:background="@color/colorprimary"> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="textview : 1 " android:textcolor="#ffffff"/> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="textview : 2" android:textcolor="#ffffff"/> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="textview : 3" android:textcolor="#ffffff"/> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="textview : 4" android:textcolor="#ffffff" /> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="textview : 5" android:textcolor="#ffffff"/> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="textview : 6" android:textcolor="#ffffff"/> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="textview : 7" android:textcolor="#ffffff"/> </linearlayout> </relativelayout> </android.support.design.widget.collapsingtoolbarlayout> </android.support.design.widget.appbarlayout> <include layout="@layout/yourview" /> </android.support.design.widget.coordinatorlayout>
update:
this work around, micmic desired action
<?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:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true" tools:context="com.example.myapplication.scrollingactivity"> <android.support.design.widget.appbarlayout android:id="@+id/app_bar" android:layout_width="match_parent" android:layout_height="@dimen/app_bar_height" android:fitssystemwindows="true" android:theme="@style/apptheme.appbaroverlay"> <android.support.design.widget.collapsingtoolbarlayout android:id="@+id/toolbar_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true" app:contentscrim="?attr/colorprimary" app:layout_scrollflags="scroll|exituntilcollapsed"> <android.support.v7.widget.toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionbarsize" app:layout_collapsemode="pin" app:popuptheme="@style/apptheme.popupoverlay" /> </android.support.design.widget.collapsingtoolbarlayout> </android.support.design.widget.appbarlayout> <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:padding="10dp" app:layout_behavior="@string/appbar_scrolling_view_behavior" android:background="@color/colorprimary"> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="textview : 1 " android:textcolor="#ffffff"/> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="textview : 2" android:textcolor="#ffffff"/> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="textview : 3" android:textcolor="#ffffff"/> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="textview : 4" android:textcolor="#ffffff" /> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="textview : 5" android:textcolor="#ffffff"/> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="textview : 6" android:textcolor="#ffffff"/> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="textview : 7" android:textcolor="#ffffff"/> </linearlayout> <!-- <include layout="@layout/content_scrolling" /> --> </android.support.design.widget.coordinatorlayout>
Comments
Post a Comment