Can Android's Navigation Component be used for navigation WITHIN a BottomSheet (i.e. replacing/adding fragments within a single bottom sheet)?
I know how to launch a BottomSheetDialogFragment
using the <dialog>
tag within a Navigation Graph. For example, the below nav_graph.xml
allows the user to navigate from one BottomSheetDialogFragment
(fragmentOne) to another BottomSheetDialogFragment
(fragmentTwo). FragmentTwo opens as a second BottomSheet over FragmentOne's BottomSheet.
However, what if I wanted fragmentTwo to replace fragmentOne WITHIN THE SAME BottomSheet? How would I accomplish this using the Navigation Graph?
<navigation android:id="@+id/nav_graph"
app:startDestination="@id/fragmentOne">
<dialog android:id="@+id/fragmentOne"
android:name="com.example.navcomponentapp.FragmentOne"
android:label="fragment_fragment_one"
tools:layout="@layout/fragment_fragment_one">
<action android:id="@+id/action_fragmentOne_to_fragmentTwo2"
app:destination="@id/fragmentTwo"/>
</dialog>
<dialog android:id="@+id/fragmentTwo"
android:name="com.example.navcomponentapp.FragmentTwo"
android:label="fragment_fragment_two"
tools:layout="@layout/fragment_fragment_two"/>
</navigation>
Demo (this is not what I want. I don't want a bottomSheet opening over another bottomSheet