When using CoordinateLayout
, I am facing a pretty strange behaviour that I guess it is a default implementation.
I have an activity that has a layout as below:
<?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:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|enterAlways">
// the header layout here
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
</android.support.v4.view.ViewPager>
</android.support.design.widget.CoordinatorLayout>
The pager has some fragments which has the UI looks like this:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.SwipeRefreshLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent">
</RecyclerView>
</android.support.v4.widget.SwipeRefreshLayout>
<View
android:id="@+id/bottom_view"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</FrameLayout>
I want the bottom_view
to pin to the bottom of the layout but as soon as the recycler view scrolls, the bottom_view
scroll as well. There is nothing special about the layout as well as the code. Is this behaviour is default or I miss something?
I have tried to wrap the bottom view by a collapse toolbar and set it to "pin" mode but it does not help.