CollapsingToolbarLayout doesn't work scrolling when fragment which has scroll_behaivor replaced

Viewed 26
    <androidx.coordinatorlayout.widget.CoordinatorLayout
        android:id="@+id/coordinator_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <com.google.android.material.appbar.AppBarLayout
            android:id="@+id/appbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:backgroundTint="@android:color/transparent"
            android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
            app:elevation="0dp">
            <com.google.android.material.appbar.CollapsingToolbarLayout
                android:id="@+id/collapsing_toolbar"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:contentScrim="@android:color/transparent"
                app:layout_scrollFlags="scroll|exitUntilCollapsed"
                app:titleEnabled="false"
                app:toolbarId="@+id/toolbar">
                <FrameLayout
                    android:id="@+id/info_container"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"/>
                <androidx.appcompat.widget.Toolbar
                    android:id="@+id/toolbar"
                    android:layout_width="match_parent"
                    android:layout_height="?android:attr/actionBarSize"
                    app:layout_collapseMode="pin"
                    app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
            </com.google.android.material.appbar.CollapsingToolbarLayout>
        </com.google.android.material.appbar.AppBarLayout>
        <FrameLayout
            android:id="@+id/list_container"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
            app:layout_behavior="@string/appbar_scrolling_view_behavior" />
            
    </androidx.coordinatorlayout.widget.CoordinatorLayout>

This is my xml code. Those FrameLayout "info_container" and "list_container" are running for Fragment. When data is fetched and replace fragments at first, scroll events work properly at both "info_container" and "list_container". But when data reloaded and replace fragments again, scroll events don't work at "info_container". And then all scroll events work well after scrolling "list_container".

Is there any problems at xml structure? Could you have any recommendation to fix this issue like which API(s) I could call after replacing fragment?

Thanks

0 Answers
Related