Skip to content

Instantly share code, notes, and snippets.

@huan-nguyen
Last active June 18, 2020 14:26
Show Gist options
  • Save huan-nguyen/b431bf19fb7ad3e83ba75297808cf6f3 to your computer and use it in GitHub Desktop.
Save huan-nguyen/b431bf19fb7ad3e83ba75297808cf6f3 to your computer and use it in GitHub Desktop.
Example of a NavGraph
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
app:startDestination="@id/dest_fragment1">
<fragment
android:id="@+id/dest_fragment1"
android:name="com.example.Fragment1"
android:label="fragment1"
tools:layout="@layout/fragment1" >
<action
android:id="@+id/action_fragment1_to_fragment2"
app:destination="@id/dest_fragment2"
app:enterAnim="@anim/slide_in_right"
app:exitAnim="@anim/slide_out_left"
app:popEnterAnim="@anim/slide_in_left"
app:popExitAnim="@anim/slide_out_right" />
</fragment>
<fragment
android:id="@+id/dest_fragment2"
android:name="com.example.Fragment2"
android:label="fragment2"
tools:layout="@layout/fragment2" />
</navigation>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment