I have activity with a crumbling toolbar and a nested scroll view using FrameLayout , in which I put fragments. I originally put in it a FragmentA with CardView .
It works great. When I click the button, although I am replacing this FragmentB with another one containing the RecyclerView .
When I add FragmentB , I cannot scroll to the bottom of the list.
This video shows the problem: VIDEO LINK
Host activity layout:
<android.support.design.widget.AppBarLayout android:id="@+id/appbar" android:layout_width="match_parent" android:layout_height="340dp" android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" android:fitsSystemWindows="true"> <android.support.design.widget.CollapsingToolbarLayout android:id="@+id/collapsing_toolbar" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_scrollFlags="scroll|exitUntilCollapsed|enterAlwaysCollapsed" android:fitsSystemWindows="true" app:contentScrim="?attr/colorPrimary" app:expandedTitleMarginStart="48dp" app:expandedTitleMarginEnd="64dp"> ......... ...... </android.support.design.widget.CollapsingToolbarLayout> </android.support.design.widget.AppBarLayout> <android.support.v4.widget.NestedScrollView android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="fill_vertical" android:fillViewport="true" app:layout_behavior="@string/appbar_scrolling_view_behavior" > <FrameLayout android:id="@+id/frame_container" android:layout_width="match_parent" android:layout_height="wrap_content" app:layout_behavior="@string/appbar_scrolling_view_behavior" > </FrameLayout> </android.support.v4.widget.NestedScrollView>
Layout FragmentB:
<android.support.v4.widget.SwipeRefreshLayout android:id="@+id/contentView" android:layout_width="match_parent" android:layout_height="wrap_content" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:android="http://schemas.android.com/apk/res/android" app:layout_behavior="@string/appbar_scrolling_view_behavior"> <android.support.v7.widget.RecyclerView android:id="@+id/rv_users" app:layout_behavior="@string/appbar_scrolling_view_behavior" android:layout_width="match_parent" android:layout_height="wrap_content" /> <include layout="@layout/view_progress" /> <include layout="@layout/view_retry" /> </android.support.v4.widget.SwipeRefreshLayout>
android android-fragments android-recyclerview
Manos
source share