android - AppBarLayout with FrameLayout container as scrolling content doesn't work -
i'm trying use newest design library make toolbar hide/show on scroll. issue scrolling content have in fragment, i'm injecting framelayout container , doesn't work. here's activity:
<android.support.v4.widget.drawerlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.design.widget.coordinatorlayout android:id="@+id/main_content" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.design.widget.appbarlayout android:layout_width="match_parent" android:layout_height="wrap_content"> <include layout="@layout/layout_toolbar" /> </android.support.design.widget.appbarlayout> <framelayout android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior" /> </android.support.design.widget.coordinatorlayout> <framelayout android:id="@+id/navigation_drawer_container" android:layout_width="@dimen/navigation_drawer_width" android:layout_height="match_parent" android:layout_gravity="start" tools:layout="@layout/fragment_nav_drawer_anon" />
and fragment:
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <android.support.v4.widget.swiperefreshlayout android:id="@+id/pull_to_refresh" android:layout_width="match_parent" android:layout_height="match_parent"> <listview android:id="@android:id/list" android:layout_width="match_parent" android:layout_height="match_parent"/> </android.support.v4.widget.swiperefreshlayout> <textview android:id="@android:id/empty" android:layout_width="match_parent" android:layout_height="match_parent" android:textsize="18sp" android:fontfamily="sans-serif" android:color="@color/dark_grey" android:padding="60dp"/>
and toolbar:
<android.support.v7.widget.toolbar xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="?attr/colorprimary" android:minheight="?attr/actionbarsize" app:layout_scrollflags="scroll|enteralways" style="@style/widget.myapp.actionbar" />
i'm following official doc , demo, , still can't figure out how make work.
replace framelayout android.support.v4.widget.nestedscrollview
nestedscrollview scrollview, supports acting both nested scrolling parent , child on both new , old versions of android. nested scrolling enabled default.
Comments
Post a Comment