I want to develop a single Activity multi fragments Apps using Jetpack Compose. For recyclerView, we have Vertical and HorizontalScroller. But, for fragments what should I use.
fun loadFragment(fragment: Fragment) {
val transaction:FragmentTransaction = supportFragmentManager.beginTransaction()
transaction.replace(R.id.f_container, fragment)
transaction.addToBackStack(null)
transaction.commit()
}
In this case, I don't have R.id.f_container because I'm creating UI using only compose.
<FrameLayout
android:id="@+id/f_container"
android:layout_width="match_parent"
android:layout_height="match_parent"`enter code here`
app:layout_behavior="@string/appbar_scrolling_view_behavior"
app:layout_constraintEnd_toEndOf="parent"
tools:layout_editor_absoluteY="-56dp">
</FrameLayout>
ViewGroup
container. That is unlikely to change. So, if you want to continue using fragments, you will need aViewGroup
in the appropriate place. Right now, with Compose/view interoperability very much a "work in progress", that probably means that your fragment will need to go into a traditional layout. – ThighAndroidViewBinding
that loads a navhost fragment (with nav graph possibly), then with navigation component you basically can also navigate through fragments that renders compose in this scenario developer.android.com/jetpack/compose/migrate/… – Capitation