# BottomNavigationView

[View Source](https://github.com/material-components/material-components-android/blob/1.14.0/lib/java/com/google/android/material/bottomnavigation/BottomNavigationView.java)

*** ** * ** ***


```
public class BottomNavigationView extends NavigationBarView
```

<br />

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) |||
| ↳ | [com.google.android.material.navigation.NavigationBarView](https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView) ||
|   | ↳ | [com.google.android.material.bottomnavigation.BottomNavigationView](https://developer.android.com/reference/com/google/android/material/bottomnavigation/BottomNavigationView) |

*** ** * ** ***

Represents a standard bottom navigation bar for application. It is an implementation of [material design bottom navigation](https://m3.material.io/components/navigation-bar/overview).

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 `https://developer.android.com/reference/com/google/android/material/behavior/HideBottomViewOnScrollBehavior`, 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 `https://developer.android.com/reference/com/google/android/material/behavior/HideBottomViewOnScrollBehavior`.

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](https://github.com/material-components/material-components-android/blob/master/docs/components/BottomNavigation.md) and [design guidelines](https://material.io/components/navigation-bar/overview).

## Summary

| ### Nested types |
|---|
| `public interface https://developer.android.com/reference/com/google/android/material/bottomnavigation/BottomNavigationView.OnNavigationItemReselectedListener extends https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView.OnItemReselectedListener` **This interface is deprecated.** Use `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView.OnItemReselectedListener` instead. <br /> |
| `public interface https://developer.android.com/reference/com/google/android/material/bottomnavigation/BottomNavigationView.OnNavigationItemSelectedListener extends https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView.OnItemSelectedListener` **This interface is deprecated.** Use `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView.OnItemSelectedListener` instead. <br /> |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/com/google/android/material/bottomnavigation/BottomNavigationView#BottomNavigationView(Context)(Context context)` |
| `https://developer.android.com/reference/com/google/android/material/bottomnavigation/BottomNavigationView#BottomNavigationView(Context,AttributeSet)(Context context, AttributeSet attrs)` |
| `https://developer.android.com/reference/com/google/android/material/bottomnavigation/BottomNavigationView#BottomNavigationView(Context,AttributeSet,int)( Context context, AttributeSet attrs, int defStyleAttr )` |
| `https://developer.android.com/reference/com/google/android/material/bottomnavigation/BottomNavigationView#BottomNavigationView(Context,AttributeSet,int,int)( Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes )` |

| ### Public methods |
|---|---|
| `int` | `https://developer.android.com/reference/com/google/android/material/bottomnavigation/BottomNavigationView#getMaxItemCount()()` Returns the maximum number of items that can be shown in NavigationBarView. |
| `boolean` | `https://developer.android.com/reference/com/google/android/material/bottomnavigation/BottomNavigationView#isItemHorizontalTranslationEnabled()()` Returns whether the items horizontally translate on selection when the item widths fill up the screen. |
| `boolean` | `https://developer.android.com/reference/com/google/android/material/bottomnavigation/BottomNavigationView#onTouchEvent(MotionEvent)(MotionEvent event)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/bottomnavigation/BottomNavigationView#setItemHorizontalTranslationEnabled(boolean)( boolean itemHorizontalTranslationEnabled )` Sets whether the menu items horizontally translate on selection when the combined item widths fill up the screen. |
| `void` | `[setOnNavigationItemReselectedListener](https://developer.android.com/reference/com/google/android/material/bottomnavigation/BottomNavigationView#setOnNavigationItemReselectedListener(com.google.android.material.bottomnavigation.BottomNavigationView.OnNavigationItemReselectedListener))( https://developer.android.com/reference/com/google/android/material/bottomnavigation/BottomNavigationView.OnNavigationItemReselectedListener listener )` **This method is deprecated.** Use `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#setOnItemReselectedListener(com.google.android.material.navigation.NavigationBarView.OnItemReselectedListener)` instead. <br /> |
| `void` | `[setOnNavigationItemSelectedListener](https://developer.android.com/reference/com/google/android/material/bottomnavigation/BottomNavigationView#setOnNavigationItemSelectedListener(com.google.android.material.bottomnavigation.BottomNavigationView.OnNavigationItemSelectedListener))( https://developer.android.com/reference/com/google/android/material/bottomnavigation/BottomNavigationView.OnNavigationItemSelectedListener listener )` **This method is deprecated.** Use `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#setOnItemSelectedListener(com.google.android.material.navigation.NavigationBarView.OnItemSelectedListener)` instead. <br /> |

| ### Protected methods |
|---|---|
| `void` | `https://developer.android.com/reference/com/google/android/material/bottomnavigation/BottomNavigationView#onMeasure(int,int)(int widthMeasureSpec, int heightMeasureSpec)` |

| ### Inherited Constants |
|---|
| From [com.google.android.material.navigation.NavigationBarView](https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView) |---|---| | `static final int` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#ACTIVE_INDICATOR_WIDTH_MATCH_PARENT() = -1` The active indicator width fills up the width of its parent. | | `static final int` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#ACTIVE_INDICATOR_WIDTH_WRAP_CONTENT() = -2` The active indicator width wraps the content. | | `static final int` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#ITEM_GRAVITY_CENTER()` Item is placed at the center of its container | | `static final int` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#ITEM_GRAVITY_START_CENTER()` Item is placed at the start center of its container | | `static final int` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#ITEM_GRAVITY_TOP_CENTER()` Item is placed at the top center of its container | | `static final int` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#ITEM_ICON_GRAVITY_START() = 1` Icon is placed at the top of the item | | `static final int` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#ITEM_ICON_GRAVITY_TOP() = 0` Icon is placed at the top of the item | | `static final int` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#LABEL_VISIBILITY_AUTO() = -1` Label behaves as "labeled" when there are 3 items or less, or "selected" when there are 4 items or more. | | `static final int` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#LABEL_VISIBILITY_LABELED() = 1` Label is shown on all navigation items. | | `static final int` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#LABEL_VISIBILITY_SELECTED() = 0` Label is shown on the selected navigation item. | | `static final int` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#LABEL_VISIBILITY_UNLABELED() = 2` Label is not shown on any navigation items. | |

| ### Inherited methods |
|---|
| From [com.google.android.material.navigation.NavigationBarView](https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView) |---|---| | `int` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#getActiveIndicatorLabelPadding()()` Get the distance between the active indicator container and the item's label. | | `https://developer.android.com/reference/com/google/android/material/badge/BadgeDrawable` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#getBadge(int)(int menuItemId)` Returns an instance of `https://developer.android.com/reference/com/google/android/material/badge/BadgeDrawable` associated with `menuItemId`, null if none was initialized. | | `int` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#getHorizontalItemTextAppearanceActive()()` Returns the text appearance used for the active menu item label when they are in the horizontal item layout (when the start icon value is `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#ITEM_ICON_GRAVITY_START()`). | | `int` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#getHorizontalItemTextAppearanceInactive()()` Returns the text appearance used for inactive menu item labels when they are in the horizontal item layout (when the start icon value is `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#ITEM_ICON_GRAVITY_START()`). | | `int` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#getIconLabelHorizontalSpacing()()` Get the horizontal distance between the icon and the item's label when the item is in the `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#ITEM_ICON_GRAVITY_START()` configuration. | | `ColorStateList` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#getItemActiveIndicatorColor()()` Get the color of the active indicator drawable. | | `int` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#getItemActiveIndicatorExpandedHeight()()` Get the height of an item's active indicator when it is expanded to wrap the item content, ie. when it is in the `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#ITEM_ICON_GRAVITY_START()` configuration. | | `int` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#getItemActiveIndicatorExpandedMarginHorizontal()()` Get the margin that will be maintained at the start and end of the expanded active indicator away from the edges of its parent container. | | `int` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#getItemActiveIndicatorExpandedWidth()()` Get the width of an item's active indicator when it is expanded to wrap the item content, ie. when it is in the `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#ITEM_ICON_GRAVITY_START()` configuration. | | `int` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#getItemActiveIndicatorHeight()()` Get the width of an item's active indicator. | | `int` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#getItemActiveIndicatorMarginHorizontal()()` Get the margin that will be maintained at the start and end of the active indicator away from the edges of its parent container. | | `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#getItemActiveIndicatorShapeAppearance()()` Get the `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel` of the active indicator drawable. | | `int` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#getItemActiveIndicatorWidth()()` Get the width of an item's active indicator. | | `Drawable` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#getItemBackground()()` Returns the background drawable of the menu items. | | `int` | `[getItemBackgroundResource](https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#getItemBackgroundResource())()` **This method is deprecated.** Use `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#getItemBackground()` instead. <br /> | | `int` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#getItemGravity()()` Returns the navigation items' layout gravity. | | `int` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#getItemIconGravity()()` Returns the current item icon gravity. | | `int` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#getItemIconSize()()` Returns the size provided for the menu item icons in pixels. | | `ColorStateList` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#getItemIconTintList()()` Returns the tint which is applied to our menu items' icons. | | `int` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#getItemPaddingBottom()()` Get the distance from the bottom of an item's label to the bottom of the navigation bar item. | | `int` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#getItemPaddingTop()()` Get the distance from the top of an item's icon/active indicator to the top of the navigation bar item. | | `ColorStateList` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#getItemRippleColor()()` Returns the color used to create a ripple as the background drawable of the menu items. | | `int` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#getItemTextAppearanceActive()()` Returns the text appearance used for the active menu item label. | | `int` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#getItemTextAppearanceInactive()()` Returns the text appearance used for inactive menu item labels. | | `ColorStateList` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#getItemTextColor()()` Returns colors used for the different states (normal, selected, focused, etc.) of the menu item text. | | `int` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#getLabelMaxLines(int)(int labelMaxLines)` Returns the max lines limit for the label text. | | `int` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#getLabelVisibilityMode()()` Returns the current label visibility mode used by this `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView`. | | `Menu` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#getMenu()()` Returns the Menu instance associated with this navigation bar. | | `ViewGroup` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#getMenuViewGroup()()` Returns the android.view.ViewGroup associated with the navigation bar menu. | | `https://developer.android.com/reference/com/google/android/material/badge/BadgeDrawable` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#getOrCreateBadge(int)(int menuItemId)` Creates an instance of `https://developer.android.com/reference/com/google/android/material/badge/BadgeDrawable` associated with `menuItemId` if none exists. | | `boolean` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#getScaleLabelTextWithFont()()` Returns whether or not the label text should scale with the system font size. | | `int` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#getSelectedItemId()()` Returns the currently selected menu item ID, or zero if there is no menu. | | `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#inflateMenu(int)(int resId)` Inflate a menu resource into this navigation view. | | `boolean` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#isItemActiveIndicatorEnabled()()` Get whether or not a selected item should show an active indicator. | | `boolean` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#isSubMenuSupported()()` Returns whether or not submenus are supported. | | `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#onAttachedToWindow()()` | | `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#onRestoreInstanceState(Parcelable)(Parcelable state)` | | `Parcelable` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#onSaveInstanceState()()` | | `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#removeBadge(int)(int menuItemId)` Removes the `https://developer.android.com/reference/com/google/android/material/badge/BadgeDrawable` associated with `menuItemId`. | | `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#setActiveIndicatorLabelPadding(int)(int activeIndicatorLabelPadding)` Set the distance between the active indicator container and the item's label. | | `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#setElevation(float)(float elevation)` Sets the base elevation of this view, in pixels. | | `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#setHorizontalItemTextAppearanceActive(int)(int textAppearanceRes)` Sets the text appearance to be used for the menu item labels when they are in the horizontal item layout (when the start icon value is `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#ITEM_ICON_GRAVITY_START()`). | | `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#setHorizontalItemTextAppearanceInactive(int)(int textAppearanceRes)` Sets the text appearance to be used for inactive menu item labels when they are in the horizontal item layout (when the start icon value is `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#ITEM_ICON_GRAVITY_START()`). | | `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#setIconLabelHorizontalSpacing(int)(int iconLabelSpacing)` Set the horizontal distance between the icon and the item's label when the item is in the `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#ITEM_ICON_GRAVITY_START()` configuration. | | `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#setItemActiveIndicatorColor(ColorStateList)(ColorStateList csl)` Set the ColorStateList of the active indicator drawable. | | `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#setItemActiveIndicatorEnabled(boolean)(boolean enabled)` Set whether a selected item should show an active indicator. | | `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#setItemActiveIndicatorExpandedHeight(int)(int height)` Set the height of an item's active indicator when it is expanded to wrap the item content, ie. when it is in the `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#ITEM_ICON_GRAVITY_START()` configuration. | | `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#setItemActiveIndicatorExpandedMarginHorizontal(int)(int horizontalMargin)` Set the horizontal margin that will be maintained at the start and end of the expanded active indicator, making sure the indicator maintains the given distance from the edge of its parent container. | | `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#setItemActiveIndicatorExpandedPadding(int,int,int,int)( int paddingLeft, int paddingTop, int paddingRight, int paddingBottom )` Set the padding of the expanded active indicator wrapping the content. | | `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#setItemActiveIndicatorExpandedWidth(int)(int width)` Set the width of an item's active indicator when it is expanded to wrap the item content, ie. when it is in the `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#ITEM_ICON_GRAVITY_START()` configuration. | | `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#setItemActiveIndicatorHeight(int)(int height)` Set the height of an item's active indicator. | | `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#setItemActiveIndicatorMarginHorizontal(int)(int horizontalMargin)` Set the horizontal margin that will be maintained at the start and end of the active indicator, making sure the indicator remains the given distance from the edge of its parent container. | | `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#setItemActiveIndicatorShapeAppearance(com.google.android.material.shape.ShapeAppearanceModel)( https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel shapeAppearance )` Set the `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel` of the active indicator drawable. | | `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#setItemActiveIndicatorWidth(int)(int width)` Set the width of an item's active indicator. | | `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#setItemBackground(Drawable)(Drawable background)` Set the background of our menu items to the given drawable. | | `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#setItemBackgroundResource(int)(int resId)` Set the background of our menu items to the given resource. | | `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#setItemGravity(int)(int itemGravity)` Sets the navigation items' layout gravity. | | `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#setItemIconGravity(int)(int itemIconGravity)` Sets the navigation items' icon gravity. | | `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#setItemIconSize(int)(int iconSize)` Set the size to provide for the menu item icons. | | `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#setItemIconSizeRes(int)(int iconSizeRes)` Set the size to provide for the menu item icons using a resource ID. | | `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#setItemIconTintList(ColorStateList)(ColorStateList tint)` Set the tint which is applied to our menu items' icons. | | `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#setItemOnTouchListener(int,OnTouchListener)(int menuItemId, OnTouchListener onTouchListener)` Sets an android.view.View.OnTouchListener for the item view associated with the provided `menuItemId`. | | `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#setItemPaddingBottom(int)(int paddingBottom)` Set the distance from the bottom of an item's label to the bottom of the navigation bar item. | | `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#setItemPaddingTop(int)(int paddingTop)` Set the distance from the top of an items icon/active indicator to the top of the navigation bar item. | | `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#setItemRippleColor(ColorStateList)(ColorStateList itemRippleColor)` Set the background of our menu items to be a ripple with the given colors. | | `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#setItemTextAppearanceActive(int)(int textAppearanceRes)` Sets the text appearance to be used for the menu item labels. | | `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#setItemTextAppearanceActiveBoldEnabled(boolean)(boolean isBold)` Sets whether the active menu item labels are bold. | | `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#setItemTextAppearanceInactive(int)(int textAppearanceRes)` Sets the text appearance to be used for inactive menu item labels. | | `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#setItemTextColor(ColorStateList)(ColorStateList textColor)` Set the colors to use for the different states (normal, selected, focused, etc.) of the menu item text. | | `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#setLabelFontScalingEnabled(boolean)(boolean labelFontScalingEnabled)` Sets whether or not the label text should scale with the system font size. | | `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#setLabelMaxLines(int)(int labelMaxLines)` Set the max lines limit for the label text. | | `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#setLabelVisibilityMode(int)(int labelVisibilityMode)` Sets the navigation items' label visibility mode. | | `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#setOnItemReselectedListener(com.google.android.material.navigation.NavigationBarView.OnItemReselectedListener)( https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView.OnItemReselectedListener listener )` Set a listener that will be notified when the currently selected navigation item is reselected. | | `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#setOnItemSelectedListener(com.google.android.material.navigation.NavigationBarView.OnItemSelectedListener)( https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView.OnItemSelectedListener listener )` Set a listener that will be notified when a navigation item is selected. | | `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#setSelectedItemId(int)(int itemId)` Set the selected menu item ID. | |

## Public constructors

### BottomNavigationView

```
public BottomNavigationView(Context context)
```

### BottomNavigationView

```
public BottomNavigationView(Context context, AttributeSet attrs)
```

### BottomNavigationView

```
public BottomNavigationView(
    Context context,
    AttributeSet attrs,
    int defStyleAttr
)
```

### BottomNavigationView

```
public BottomNavigationView(
    Context context,
    AttributeSet attrs,
    int defStyleAttr,
    int defStyleRes
)
```

## Public methods

### getMaxItemCount

```
public int getMaxItemCount()
```

Returns the maximum number of items that can be shown in NavigationBarView.

### isItemHorizontalTranslationEnabled

```
public boolean isItemHorizontalTranslationEnabled()
```

Returns whether the items horizontally translate on selection when the item widths fill up the screen.

| Returns |
|---|---|
| `boolean` | whether the menu items horizontally translate on selection |

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/bottomnavigation/BottomNavigationView#setItemHorizontalTranslationEnabled(boolean)` |   |

### onTouchEvent

```
public boolean onTouchEvent(MotionEvent event)
```

### setItemHorizontalTranslationEnabled

```
public void setItemHorizontalTranslationEnabled(
    boolean itemHorizontalTranslationEnabled
)
```

Sets whether the menu items horizontally translate on selection when the combined item widths fill up the screen.

| Parameters |
|---|---|
| `boolean itemHorizontalTranslationEnabled` | whether the items horizontally translate on selection |

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/bottomnavigation/BottomNavigationView#isItemHorizontalTranslationEnabled()` |   |

### setOnNavigationItemReselectedListener

```
public void [setOnNavigationItemReselectedListener](https://developer.android.com/reference/com/google/android/material/bottomnavigation/BottomNavigationView#setOnNavigationItemReselectedListener(com.google.android.material.bottomnavigation.BottomNavigationView.OnNavigationItemReselectedListener))(
    BottomNavigationView.OnNavigationItemReselectedListener listener
)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#setOnItemReselectedListener(com.google.android.material.navigation.NavigationBarView.OnItemReselectedListener)` instead.

Set a listener that will be notified when the currently selected bottom navigation item is reselected. This does not require an `https://developer.android.com/reference/com/google/android/material/bottomnavigation/BottomNavigationView.OnNavigationItemSelectedListener` to be set.

| Parameters |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/bottomnavigation/BottomNavigationView.OnNavigationItemReselectedListener listener` | The listener to notify |

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/bottomnavigation/BottomNavigationView#setOnNavigationItemSelectedListener(com.google.android.material.bottomnavigation.BottomNavigationView.OnNavigationItemSelectedListener)` |   |

### setOnNavigationItemSelectedListener

```
public void [setOnNavigationItemSelectedListener](https://developer.android.com/reference/com/google/android/material/bottomnavigation/BottomNavigationView#setOnNavigationItemSelectedListener(com.google.android.material.bottomnavigation.BottomNavigationView.OnNavigationItemSelectedListener))(
    BottomNavigationView.OnNavigationItemSelectedListener listener
)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/com/google/android/material/navigation/NavigationBarView#setOnItemSelectedListener(com.google.android.material.navigation.NavigationBarView.OnItemSelectedListener)` instead.

Set a listener that will be notified when a bottom navigation item is selected. This listener will also be notified when the currently selected item is reselected, unless an `https://developer.android.com/reference/com/google/android/material/bottomnavigation/BottomNavigationView.OnNavigationItemReselectedListener` has also been set.

| Parameters |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/bottomnavigation/BottomNavigationView.OnNavigationItemSelectedListener listener` | The listener to notify |

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/bottomnavigation/BottomNavigationView#setOnNavigationItemReselectedListener(com.google.android.material.bottomnavigation.BottomNavigationView.OnNavigationItemReselectedListener)` |   |

## Protected methods

### onMeasure

```
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
```