Bottom navigation view in Android using Kotlin:

Bottom navigation Part 1:–

Step 1. Add  BottomNavigationView in LayoutFile
Step 2. Add some icons in App
Step 3. Create menu resource in android studio without icon
Step 4. Add icons in menu resource file
Step 5.  Attach menu resource with BottomNavigationView
Step 6. Apply Listener with BottomNavigationView

Use toast on BottomNavigationView event

Steps start 

Step 1. Start a new project
Step 2. drawable-> new->vector asset-> select icon 
Step 3. menu -> android resources file-> create menu 
Step 4. name of first item is Home 
              name 2 second item is About
Step 5. attributes-> menu 

Go to Main Activity.kt :

Val msg= when(it.itemID)
{>”About Selected”
else ->”Home selected”
Toast.make text(this @MainActivity,msg,Toast.LENGTH_LONG).show()

Want to say something? Post a comment

Your email address will not be published. Required fields are marked *