Skip to content

Instantly share code, notes, and snippets.

@skydoves
Created April 26, 2022 00:54
Show Gist options
  • Save skydoves/5570aa24f6f164705d60c0f3c559892e to your computer and use it in GitHub Desktop.
Save skydoves/5570aa24f6f164705d60c0f3c559892e to your computer and use it in GitHub Desktop.
nav_main_example
<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawerLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.fragment.app.FragmentContainerView
android:id="@+id/nav_host_fragment"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:defaultNavHost="true"
app:navGraph="@navigation/nav_graph" />
<com.google.android.material.navigation.NavigationView
android:id="@+id/navView"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:menu="@menu/menu_navigation" />
</androidx.drawerlayout.widget.DrawerLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment