I want to develop an app where I will use bottom navigation bar and when user will choose the option item it would show the side bar like the following image that comes from either left or right side, but the option button will be in bottom navbar.
Navigation bar:
First you have to create a Navigation View and bottom navigation bar.
NavigationView
<com.google.android.material.navigation.NavigationView
android:id="@+id/navigationView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:headerLayout="@layout/drawer_header"
app:menu="@menu/menu_drawer"
android:layout_gravity="start"/>
Bottom Navigation Bar
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottomNavigation"
android:layout_width="match_parent"
android:layout_height="55dp"
style="@style/Widget.MaterialComponents.BottomNavigationView.Colored"
android:layout_alignParentBottom="true"
app:menu="@menu/bottom_navigation_menu"
android:background="@color/colorPrimaryDark"
app:itemTextColor="@color/white"
app:labelVisibilityMode="labeled"/>
Now to open drawer you have to set your drawer layout (which will be the parent layout) inside setOnNavigationItemSelectedListener like this
bottomNavigation.setOnNavigationItemSelectedListener{
when(it.itemId){
R.id.your_bottom_menu_selected_id->{
drawer_layout_id.openDrawer(navigationView)
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With