BottomNavigationView

SESL variant Represents a standard bottom navigation bar for application. It is an implementation of material design bottom navigation.

Bottom navigation bars make it easy for users to explore and switch between top-level views in a single tap. They should be used when an application has three to five top-level destinations.

The bar can disappear on scroll, based on , when it is placed within a CoordinatorLayout and one of the children within the CoordinatorLayout is scrolled. This behavior is only set if the layout_behavior property is set to .

The bar contents can be populated by specifying a menu resource file. Each menu item title, icon and enabled state will be used for displaying bottom navigation bar items. Menu items can also be used for programmatically selecting which destination is currently active. It can be done using MenuItem#setChecked(true)

layout resource file:
<com.google.android.material.bottomnavigation.BottomNavigationView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schema.android.com/apk/res/res-auto"
    android:id="@+id/navigation"
    android:layout_width="match_parent"
    android:layout_height="56dp"
    android:layout_gravity="start"
    app:menu="@menu/my_navigation_items" />

res/menu/my_navigation_items.xml:
<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:id="@+id/action_search"
         android:title="@string/menu_search"
         android:icon="@drawable/ic_search" />
    <item android:id="@+id/action_settings"
         android:title="@string/menu_settings"
         android:icon="@drawable/ic_add" />
    <item android:id="@+id/action_navigation"
         android:title="@string/menu_navigation"
         android:icon="@drawable/ic_action_navigation_menu" />
</menu>

For more information, see the component developer guidance and design guidelines.

Constructors

Link copied to clipboard
constructor(@NonNull context: Context)
constructor(@NonNull context: Context, @Nullable attrs: AttributeSet)
constructor(@NonNull context: Context, @Nullable attrs: AttributeSet, defStyleAttr: Int)
constructor(@NonNull context: Context, @Nullable attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int)

Types

Link copied to clipboard
Listener for handling reselection events on bottom navigation items.
Link copied to clipboard
Listener for handling selection events on bottom navigation items.

Functions

Link copied to clipboard
open fun getMaxItemCount(): Int
Returns the maximum number of items that can be shown in NavigationBarView.
Link copied to clipboard
Returns whether the items horizontally translate on selection when the item widths fill up the screen.
Link copied to clipboard
Link copied to clipboard
open fun setItemHorizontalTranslationEnabled(itemHorizontalTranslationEnabled: Boolean)
Sets whether the menu items horizontally translate on selection when the combined item widths fill up the screen.
Link copied to clipboard
Set a listener that will be notified when the currently selected bottom navigation item is reselected.
Link copied to clipboard
Set a listener that will be notified when a bottom navigation item is selected.