I have a the following layout in a fragment
Header Image
====================================
Tab 1. Tab2. Tab3.
====================================
Frag A. Frag B. Frag C.
This fragment has a motion scene that when you scroll up the header image transitions to the regular toolbar. I am trying to migrate the fragment from Tab3 to compose by simply using the xml Compose tag and just doing setContent
in its fragment
This works but when I try to scroll up on the fragment the motion scene no longer works and only scrolls up and down within its content (sorta like a nested scrollview)
is it possible to still trigger the motion layout so that the fragment move up and behaves as it was before?
Update :
Marked answer as accepted. My xml was also out of whack which I had to remove the SwipeRefreshLayout since this will be managed in compose.
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/swipeToRefreshLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.compose.ui.platform.ComposeView
android:id="@+id/compose_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
Add this code to the modifier of your top content.
.nestedScroll(rememberNestedScrollInteropConnection())