# NavigationView

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

*** ** * ** ***


```
public class NavigationView
```

<br />

*** ** * ** ***

Represents a standard navigation menu for application. The menu contents can be populated by a menu resource file.

NavigationView is typically placed inside a androidx.drawerlayout.widget.DrawerLayout.

```
<androidx.drawerlayout.widget.DrawerLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true">

    <!-- Your contents -->

    <com.google.android.material.navigation.NavigationView
        android:id="@+id/navigation"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        app:menu="@menu/my_navigation_items" />
</androidx.drawerlayout.widget.DrawerLayout>
```

For more information, see the [component developer guidance](https://github.com/material-components/material-components-android/blob/master/docs/components/NavigationDrawer.md) and [design guidelines](https://material.io/components/navigation-drawer/overview).

## Summary

| ### Nested types |
|---|
| `public interface https://developer.android.com/reference/com/google/android/material/navigation/NavigationView.OnNavigationItemSelectedListener` Listener for handling events on navigation items. |
| `public class https://developer.android.com/reference/com/google/android/material/navigation/NavigationView.SavedState` User interface state that is stored by NavigationView for implementing onSaveInstanceState(). |

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

| ### Public methods |
|---|---|
| `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#addHeaderView(View)(View view)` Adds a View as a header of the navigation menu. |
| `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#cancelBackProgress()()` Call this method from onBackCancelled or handleOnBackCancelled so that the back handler can cancel the back animation. |
| `MenuItem` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#getCheckedItem()()` Returns the currently checked item in this navigation menu. |
| `int` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#getDividerInsetEnd()()` Get the distance between the end of a divider and the end of the NavigationView. |
| `int` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#getDividerInsetStart()()` Get the distance between the start edge of the NavigationView and the start of a menu divider. |
| `int` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#getHeaderCount()()` Gets the number of headers in this NavigationView. |
| `View` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#getHeaderView(int)(int index)` Gets the header view at the specified position. |
| `Drawable` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#getItemBackground()()` Returns the background drawable for our menu items. |
| `int` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#getItemHorizontalPadding()()` Returns the horizontal (left and right) padding in pixels applied to menu items. |
| `int` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#getItemIconPadding()()` Returns the padding in pixels between the icon (if present) and the text of menu items. |
| `ColorStateList` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#getItemIconTintList()()` Returns the tint which is applied to our menu items' icons. |
| `int` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#getItemMaxLines()()` Gets the android:maxLines attribute of the text view in the menu item. |
| `ColorStateList` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#getItemTextColor()()` Returns the tint which is applied to our menu items' icons. |
| `int` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#getItemVerticalPadding()()` Returns the vertical (top and bottom) padding in pixels applied to menu items. |
| `Menu` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#getMenu()()` Returns the Menu instance associated with this navigation view. |
| `int` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#getSubheaderInsetEnd()()` Get the distance between the end of a menu subheader and the end of the NavigationView. |
| `int` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#getSubheaderInsetStart()()` Get the distance between the start of the NavigationView and the start of a menu subheader. |
| `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#handleBackInvoked()()` Call this method from onBackInvoked or handleOnBackPressed so that the back handler can complete the back animation, or handle back without progress in certain cases. |
| `View` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#inflateHeaderView(int)(int res)` Inflates a View and add it as a header of the navigation menu. |
| `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#inflateMenu(int)(int resId)` Inflate a menu resource into this navigation view. |
| `boolean` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#isBottomInsetScrimEnabled()()` Whether or not the NavigationView will draw a scrim behind the window's bottom inset. |
| `boolean` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#isEndInsetScrimEnabled()()` Whether or not the NavigationView will draw a scrim behind the window's end inset. |
| `boolean` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#isStartInsetScrimEnabled()()` Whether or not the NavigationView will draw a scrim behind the window's start inset. |
| `boolean` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#isTopInsetScrimEnabled()()` Whether or not the NavigationView will draw a scrim behind the window's top inset. |
| `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#removeHeaderView(View)(View view)` Removes a previously-added header view. |
| `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#setBottomInsetScrimEnabled(boolean)(boolean enabled)` Set whether or not the NavigationView should draw a scrim behind the window's bottom inset (typically the navigation bar) |
| `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#setCheckedItem(MenuItem)(MenuItem checkedItem)` Sets the currently checked item in this navigation menu. |
| `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#setCheckedItem(int)(int id)` Sets the currently checked item in this navigation menu. |
| `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#setDividerInsetEnd(int)(int dividerInsetEnd)` Set the distance between the end of a divider and the end of the NavigationView. |
| `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#setDividerInsetStart(int)(int dividerInsetStart)` Set the distance between the start edge of the NavigationView and the start of a menu divider. |
| `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#setElevation(float)(float elevation)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#setEndInsetScrimEnabled(boolean)(boolean enabled)` Set whether or not the NavigationView should draw a scrim behind the window's end inset. |
| `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#setItemBackground(Drawable)(Drawable itemBackground)` Set the background of our menu items to a given resource. |
| `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#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/NavigationView#setItemHorizontalPadding(int)(int padding)` Set the horizontal (left and right) padding in pixels of menu items. |
| `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#setItemHorizontalPaddingResource(int)(int paddingResource)` Set the horizontal (left and right) padding of menu items. |
| `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#setItemIconPadding(int)(int padding)` Set the padding in pixels between the icon (if present) and the text of menu items. |
| `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#setItemIconPaddingResource(int)(int paddingResource)` Set the padding between the icon (if present) and the text of menu items. |
| `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#setItemIconSize(int)(int iconSize)` Sets the size to be used for the menu item icons in pixels. |
| `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#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/NavigationView#setItemMaxLines(int)(int itemMaxLines)` Sets the android:maxLines attribute of the text view in the menu item. |
| `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#setItemTextAppearance(int)(int resId)` Set the text appearance of the menu items to a given resource. |
| `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#setItemTextAppearanceActiveBoldEnabled(boolean)(boolean isBold)` Sets whether the active menu item label is bold. |
| `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#setItemTextColor(ColorStateList)(ColorStateList textColor)` Set the text color to be used on our menu items. |
| `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#setItemVerticalPadding(int)(int padding)` Set the vertical (top and bottom) padding in pixels of menu items. |
| `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#setItemVerticalPaddingResource(int)(int paddingResource)` Set the vertical (top and bottom) padding of menu items. |
| `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#setNavigationItemSelectedListener(com.google.android.material.navigation.NavigationView.OnNavigationItemSelectedListener)( https://developer.android.com/reference/com/google/android/material/navigation/NavigationView.OnNavigationItemSelectedListener listener )` Set a listener that will be notified when a menu item is selected. |
| `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#setOverScrollMode(int)(int overScrollMode)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#setStartInsetScrimEnabled(boolean)(boolean enabled)` Set whether or not the NavigationView should draw a scrim behind the window's start inset. |
| `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#setSubheaderInsetEnd(int)(int subheaderInsetEnd)` Set the distance between the end of a menu subheader and the end of the NavigationView. |
| `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#setSubheaderInsetStart(int)(int subheaderInsetStart)` Set the distance between the start of the NavigationView and the start of a menu subheader. |
| `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#setTopInsetScrimEnabled(boolean)(boolean enabled)` Set whether or not the NavigationView should draw a scrim behind the window's top inset (typically the status bar). |
| `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#startBackProgress(BackEventCompat)(BackEventCompat backEvent)` Call this method from onBackStarted or handleOnBackStarted so that the back handler can initialize and start animating. |
| `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#updateBackProgress(BackEventCompat)(BackEventCompat backEvent)` Call this method from onBackProgressed or handleOnBackProgressed so that the back handler can continue animating with a new progress value. |

| ### Protected methods |
|---|---|
| `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#dispatchDraw(Canvas)(Canvas canvas)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#onAttachedToWindow()()` |
| `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#onDetachedFromWindow()()` |
| `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#onMeasure(int,int)(int widthSpec, int heightSpec)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#onRestoreInstanceState(Parcelable)(Parcelable savedState)` |
| `Parcelable` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#onSaveInstanceState()()` |
| `void` | `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#onSizeChanged(int,int,int,int)(int w, int h, int oldw, int oldh)` |

## Public constructors

### NavigationView

```
public NavigationView(Context context)
```

### NavigationView

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

### NavigationView

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

## Public methods

### addHeaderView

```
public void addHeaderView(View view)
```

Adds a View as a header of the navigation menu.

| Parameters |
|---|---|
| `View view` | The view to be added as a header of the navigation menu. |

### cancelBackProgress

```
public void cancelBackProgress()
```

Call this method from onBackCancelled or handleOnBackCancelled so that the back handler can cancel the back animation.

### getCheckedItem

```
public MenuItem getCheckedItem()
```

Returns the currently checked item in this navigation menu.

### getDividerInsetEnd

```
public int getDividerInsetEnd()
```

Get the distance between the end of a divider and the end of the NavigationView.

### getDividerInsetStart

```
public int getDividerInsetStart()
```

Get the distance between the start edge of the NavigationView and the start of a menu divider.

### getHeaderCount

```
public int getHeaderCount()
```

Gets the number of headers in this NavigationView.

| Returns |
|---|---|
| `int` | A positive integer representing the number of headers. |

### getHeaderView

```
public View getHeaderView(int index)
```

Gets the header view at the specified position.

| Parameters |
|---|---|
| `int index` | The position at which to get the view from. |

| Returns |
|---|---|
| `View` | The header view the specified position or null if the position does not exist in this NavigationView. |

### getItemBackground

```
public Drawable getItemBackground()
```

Returns the background drawable for our menu items.

ref R.styleable#NavigationView_itemBackground

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#setItemBackgroundResource(int)` |   |

### getItemHorizontalPadding

```
public int getItemHorizontalPadding()
```

Returns the horizontal (left and right) padding in pixels applied to menu items.

ref R.styleable#NavigationView_itemHorizontalPadding

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#setItemHorizontalPadding(int)` |   |

### getItemIconPadding

```
public int getItemIconPadding()
```

Returns the padding in pixels between the icon (if present) and the text of menu items.

ref R.styleable#NavigationView_itemIconPadding

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#setItemIconPadding(int)` |   |

### getItemIconTintList

```
public ColorStateList getItemIconTintList()
```

Returns the tint which is applied to our menu items' icons.

ref R.styleable#NavigationView_itemIconTint

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#setItemIconTintList(ColorStateList)` |   |

### getItemMaxLines

```
public int getItemMaxLines()
```

Gets the android:maxLines attribute of the text view in the menu item.

ref R.styleable#NavigationView_itemMaxLines

### getItemTextColor

```
public ColorStateList getItemTextColor()
```

Returns the tint which is applied to our menu items' icons.

ref R.styleable#NavigationView_itemTextColor

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#setItemTextColor(ColorStateList)` |   |

### getItemVerticalPadding

```
public int getItemVerticalPadding()
```

Returns the vertical (top and bottom) padding in pixels applied to menu items.

ref R.styleable#NavigationView_itemVerticalPadding

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#setItemVerticalPadding(int)` |   |

### getMenu

```
public Menu getMenu()
```

Returns the Menu instance associated with this navigation view.

### getSubheaderInsetEnd

```
public int getSubheaderInsetEnd()
```

Get the distance between the end of a menu subheader and the end of the NavigationView.

### getSubheaderInsetStart

```
public int getSubheaderInsetStart()
```

Get the distance between the start of the NavigationView and the start of a menu subheader.

### handleBackInvoked

```
public void handleBackInvoked()
```

Call this method from onBackInvoked or handleOnBackPressed so that the back handler can complete the back animation, or handle back without progress in certain cases.

### inflateHeaderView

```
public View inflateHeaderView(int res)
```

Inflates a View and add it as a header of the navigation menu.

| Parameters |
|---|---|
| `int res` | The layout resource ID. |

| Returns |
|---|---|
| `View` | a newly inflated View. |

### inflateMenu

```
public void inflateMenu(int resId)
```

Inflate a menu resource into this navigation view.

Existing items in the menu will not be modified or removed.

| Parameters |
|---|---|
| `int resId` | ID of a menu resource to inflate |

### isBottomInsetScrimEnabled

```
public boolean isBottomInsetScrimEnabled()
```

Whether or not the NavigationView will draw a scrim behind the window's bottom inset.

### isEndInsetScrimEnabled

```
public boolean isEndInsetScrimEnabled()
```

Whether or not the NavigationView will draw a scrim behind the window's end inset.

### isStartInsetScrimEnabled

```
public boolean isStartInsetScrimEnabled()
```

Whether or not the NavigationView will draw a scrim behind the window's start inset.

### isTopInsetScrimEnabled

```
public boolean isTopInsetScrimEnabled()
```

Whether or not the NavigationView will draw a scrim behind the window's top inset.

### removeHeaderView

```
public void removeHeaderView(View view)
```

Removes a previously-added header view.

| Parameters |
|---|---|
| `View view` | The view to remove |

### setBottomInsetScrimEnabled

```
public void setBottomInsetScrimEnabled(boolean enabled)
```

Set whether or not the NavigationView should draw a scrim behind the window's bottom inset (typically the navigation bar)

| Parameters |
|---|---|
| `boolean enabled` | true when the NavigationView should draw a scrim. |

### setCheckedItem

```
public void setCheckedItem(MenuItem checkedItem)
```

Sets the currently checked item in this navigation menu.

| Parameters |
|---|---|
| `MenuItem checkedItem` | The checked item from the menu available from `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#getMenu()`. |

### setCheckedItem

```
public void setCheckedItem(int id)
```

Sets the currently checked item in this navigation menu.

| Parameters |
|---|---|
| `int id` | The item ID of the currently checked item. |

### setDividerInsetEnd

```
public void setDividerInsetEnd(int dividerInsetEnd)
```

Set the distance between the end of a divider and the end of the NavigationView.

### setDividerInsetStart

```
public void setDividerInsetStart(int dividerInsetStart)
```

Set the distance between the start edge of the NavigationView and the start of a menu divider.

### setElevation

```
public void setElevation(float elevation)
```

### setEndInsetScrimEnabled

```
public void setEndInsetScrimEnabled(boolean enabled)
```

Set whether or not the NavigationView should draw a scrim behind the window's end inset.

| Parameters |
|---|---|
| `boolean enabled` | true when the NavigationView should draw a scrim. |

### setItemBackground

```
public void setItemBackground(Drawable itemBackground)
```

Set the background of our menu items to a given resource. The resource should refer to a Drawable object or null to use the default background set on this navigation menu.

ref R.styleable#NavigationView_itemBackground

### setItemBackgroundResource

```
public void setItemBackgroundResource(int resId)
```

Set the background of our menu items to the given resource. This overrides the default background set to items and it's styling.

ref R.styleable#NavigationView_itemBackground

| Parameters |
|---|---|
| `int resId` | The identifier of the resource. |

### setItemHorizontalPadding

```
public void setItemHorizontalPadding(int padding)
```

Set the horizontal (left and right) padding in pixels of menu items.

ref R.styleable#NavigationView_itemHorizontalPadding

| Parameters |
|---|---|
| `int padding` | The horizontal padding in pixels. |

### setItemHorizontalPaddingResource

```
public void setItemHorizontalPaddingResource(int paddingResource)
```

Set the horizontal (left and right) padding of menu items.

ref R.styleable#NavigationView_itemHorizontalPadding

| Parameters |
|---|---|
| `int paddingResource` | Dimension resource to use for the horizontal padding. |

### setItemIconPadding

```
public void setItemIconPadding(int padding)
```

Set the padding in pixels between the icon (if present) and the text of menu items.

ref R.styleable#NavigationView_itemIconPadding

| Parameters |
|---|---|
| `int padding` | The padding in pixels. |

### setItemIconPaddingResource

```
public void setItemIconPaddingResource(int paddingResource)
```

Set the padding between the icon (if present) and the text of menu items.

ref R.styleable#NavigationView_itemIconPadding

| Parameters |
|---|---|
| `int paddingResource` | Dimension resource to use for the icon padding. |

### setItemIconSize

```
public void setItemIconSize(int iconSize)
```

Sets the size to be used for the menu item icons in pixels. If no icons are set, calling this method will do nothing.

ref R.styleable#NavigationView_itemIconSize

### setItemIconTintList

```
public void setItemIconTintList(ColorStateList tint)
```

Set the tint which is applied to our menu items' icons.

ref R.styleable#NavigationView_itemIconTint

| Parameters |
|---|---|
| `ColorStateList tint` | the tint to apply. |

### setItemMaxLines

```
public void setItemMaxLines(int itemMaxLines)
```

Sets the android:maxLines attribute of the text view in the menu item.

ref R.styleable#NavigationView_itemMaxLines

### setItemTextAppearance

```
public void setItemTextAppearance(int resId)
```

Set the text appearance of the menu items to a given resource.

ref R.styleable#NavigationView_itemTextAppearance

### setItemTextAppearanceActiveBoldEnabled

```
public void setItemTextAppearanceActiveBoldEnabled(boolean isBold)
```

Sets whether the active menu item label is bold.

ref R.styleable#NavigationView_itemTextAppearanceActiveBoldEnabled

### setItemTextColor

```
public void setItemTextColor(ColorStateList textColor)
```

Set the text color to be used on our menu items.

ref R.styleable#NavigationView_itemTextColor

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/navigation/NavigationView#getItemTextColor()` |   |

### setItemVerticalPadding

```
public void setItemVerticalPadding(int padding)
```

Set the vertical (top and bottom) padding in pixels of menu items.

ref R.styleable#NavigationView_itemVerticalPadding

| Parameters |
|---|---|
| `int padding` | The vertical padding in pixels. |

### setItemVerticalPaddingResource

```
public void setItemVerticalPaddingResource(int paddingResource)
```

Set the vertical (top and bottom) padding of menu items.

ref R.styleable#NavigationView_itemVerticalPadding

| Parameters |
|---|---|
| `int paddingResource` | Dimension resource to use for the vertical padding. |

### setNavigationItemSelectedListener

```
public void setNavigationItemSelectedListener(
    NavigationView.OnNavigationItemSelectedListener listener
)
```

Set a listener that will be notified when a menu item is selected.

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

### setOverScrollMode

```
public void setOverScrollMode(int overScrollMode)
```

### setStartInsetScrimEnabled

```
public void setStartInsetScrimEnabled(boolean enabled)
```

Set whether or not the NavigationView should draw a scrim behind the window's start inset.

| Parameters |
|---|---|
| `boolean enabled` | true when the NavigationView should draw a scrim. |

### setSubheaderInsetEnd

```
public void setSubheaderInsetEnd(int subheaderInsetEnd)
```

Set the distance between the end of a menu subheader and the end of the NavigationView.

### setSubheaderInsetStart

```
public void setSubheaderInsetStart(int subheaderInsetStart)
```

Set the distance between the start of the NavigationView and the start of a menu subheader.

### setTopInsetScrimEnabled

```
public void setTopInsetScrimEnabled(boolean enabled)
```

Set whether or not the NavigationView should draw a scrim behind the window's top inset (typically the status bar).

| Parameters |
|---|---|
| `boolean enabled` | true when the NavigationView should draw a scrim. |

### startBackProgress

```
public void startBackProgress(BackEventCompat backEvent)
```

Call this method from onBackStarted or handleOnBackStarted so that the back handler can initialize and start animating.

Note that this must be called prior to calling `https://developer.android.com/reference/com/google/android/material/motion/MaterialBackHandler#updateBackProgress(BackEventCompat)`.

### updateBackProgress

```
public void updateBackProgress(BackEventCompat backEvent)
```

Call this method from onBackProgressed or handleOnBackProgressed so that the back handler can continue animating with a new progress value.

## Protected methods

### dispatchDraw

```
protected void dispatchDraw(Canvas canvas)
```

### onAttachedToWindow

```
protected void onAttachedToWindow()
```

### onDetachedFromWindow

```
protected void onDetachedFromWindow()
```

### onMeasure

```
protected void onMeasure(int widthSpec, int heightSpec)
```

### onRestoreInstanceState

```
protected void onRestoreInstanceState(Parcelable savedState)
```

### onSaveInstanceState

```
protected Parcelable onSaveInstanceState()
```

### onSizeChanged

```
protected void onSizeChanged(int w, int h, int oldw, int oldh)
```