BottomNavigationView
In this tutorial we will learn, how to add a bottom navigation to your activity and use it to switch between different fragments. We will fill our BottomNavigationView with 3 menu items and then check which item was selected with the OnNavigationItemSelectedListener interface and a switch statement. We will then create the appropriate fragment and display it in a FrameLayout with help of the getSupportFragmentManager, beginTransaction and replace methods. Link & Dependencies:- developer.android.com/topic/libraries/support-library/packages.html#design Add a directory in res folder and name it as menu. After adding menu folder in res folder add a xml file and name it bottom_navigation.xml. <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/nav_home" android:icon="@drawable/ic_home_black_24dp" android:titl...
Comments