Skip to content

Commit

Permalink
Add navigation view to activity_main.xml file
Browse files Browse the repository at this point in the history
  • Loading branch information
Yağmur Erdoğan committed Aug 19, 2021
1 parent 5946855 commit 8f49b94
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:navGraph="@navigation/my_nav" />

</androidx.constraintlayout.widget.ConstraintLayout>
1 change: 1 addition & 0 deletions NavigationComponent2/.idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

62 changes: 39 additions & 23 deletions NavigationComponent2/app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,33 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http:https://schemas.android.com/apk/res/android"
<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http:https://schemas.android.com/apk/res/android"
xmlns:app="http:https://schemas.android.com/apk/res-auto"
xmlns:tools="http:https://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">

<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/purple_500"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

<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"
android:layout_above="@id/bottom_nav"
android:layout_below="@id/toolbar"
app:defaultNavHost="true"
app:navGraph="@navigation/nav_graph" />
android:layout_height="match_parent">

<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottom_nav"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/purple_500"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

<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"
android:layout_above="@id/bottom_nav"
android:layout_below="@id/toolbar"
app:defaultNavHost="true"
app:navGraph="@navigation/nav_graph" />

<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottom_nav"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
app:menu="@menu/drawer_bottom_nav_menu" />

</RelativeLayout>

<com.google.android.material.navigation.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
app:menu="@menu/drawer_bottom_nav_menu" />
</RelativeLayout>


</androidx.drawerlayout.widget.DrawerLayout>

0 comments on commit 8f49b94

Please sign in to comment.