here is my activity_article_list.xml
<android.support.design.widget.CoordinatorLayout
...
android:fitsSystemWindows="true"
android:theme="@style/MyTheme">
<android.support.design.widget.AppBarLayout
...
android:fitsSystemWindows="true"
android:theme="@style/MyAppBarTheme">
<android.support.design.widget.CollapsingToolbarLayout
...
android:fitsSystemWindows="true"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<include layout="@layout/activity_toolbar" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<LinearLayout
...
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<com.malinskiy.superrecyclerview.SuperRecyclerView
.../>
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>
and this is activity_toolbar.xml
<android.support.v7.widget.Toolbar
...
android:id="@+id/list_toolbar"
android:elevation="4dp"
app:layout_collapseMode="pin"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/MyTheme">
<RelativeLayout>
<ImageButton
... />
<ImageButton
.../>
<TextView
... />
</RelativeLayout>
</android.support.v7.widget.Toolbar>
in style, MyTheme is Theme.AppCompat.Light.NoActionBar
,
and MyAppBarTheme is ThemeOverlay.AppCompat.ActionBar
.
i saw many questions about collapsing toolbar.
I think my xml is similar to the content of a question or lecture.
i think the point is layout_scrollFlags
, layout_collapseMode
, layout_scrollFlags
.
however, toolbar didn't disappear according to the scroll.
it remains in place.
has MyAppBarTheme wrong parent?
or any wrong codes?
Edit : my full code in activity_article_list.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/root_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:theme="@style/MyTheme">
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/MyAppBarTheme">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsingToolbarLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways">
<android.support.v7.widget.Toolbar
android:id="@+id/list_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:minHeight="0dp"
android:background="@color/colorPrimary"
app:layout_collapseMode="pin"
app:popupTheme="@style/MyTheme">
<TextView
android:id="@+id/boardName"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:textColor="@color/textColorPrimary"
android:textSize="20dp" />
</android.support.v7.widget.Toolbar>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<com.malinskiy.superrecyclerview.SuperRecyclerView
android:id="@+id/article_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/windowBackground"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>