1)Create empty Activity 2)Create layout folder and add “activity_main.xml” file in it 3)How to create Navigation folder and navigation graph: i)Add dependencies in build.gradle file implementation("androidx.constraintlayout:constraintlayout-compose:1.0.0-alpha08") implementation("androidx.navigation:navigation-fragment-ktx:2.3.5") implementation("androidx.navigation:navigation-ui-ktx:2.3.5") implementation("androidx.navigation:navigation-dynamic-features-fragment:2.3.5") ii)Create navigation folder and add nav_graph.xml in it iii)Create “new destination” in nav_graph.xml then select 2 blank fragments and name it as “HomeFragment” and “DataFragment” 4)Add the following steps in activity_main.xml: i)Add constraint layout ii)Drag and drop fragment container view and select “HomeFragment.kt” add:navGraph=”@navigation/nav_graph” 5)Add the following steps in HomeFragment in xml: i)Add Constraint View ii)Add Text View iii)Add Button 6)Add the following steps in DataFragment in xml: i)Add Constraint View ii)Add Text View iii)Add Button
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter