# AppBarConfiguration

Artifact: [androidx.navigation:navigation-ui](https://developer.android.com/jetpack/androidx/releases/navigation) [View Source](https://cs.android.com/search?q=file:androidx/navigation/ui/AppBarConfiguration.kt+class:androidx.navigation.ui.AppBarConfiguration) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/navigation#1.0.0)

*** ** * ** ***

<br />

```
public final class AppBarConfiguration
```

<br />

*** ** * ** ***

Configuration options for `https://developer.android.com/reference/androidx/navigation/ui/NavigationUI` methods that interact with implementations of the app bar pattern such as `https://developer.android.com/reference/androidx/appcompat/widget/Toolbar`, `https://developer.android.com/reference/com/google/android/material/appbar/CollapsingToolbarLayout.html`, and `https://developer.android.com/reference/androidx/appcompat/app/ActionBar`.

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/androidx/navigation/ui/AppBarConfiguration.Builder` The Builder class for constructing new `https://developer.android.com/reference/androidx/navigation/ui/AppBarConfiguration` instances. |
| `public fun interface https://developer.android.com/reference/androidx/navigation/ui/AppBarConfiguration.OnNavigateUpListener` Interface for providing custom 'up' behavior beyond what is provided by `https://developer.android.com/reference/androidx/navigation/NavController#navigateUp()`. |

| ### Public methods |
|---|---|
| `final https://developer.android.com/reference/androidx/drawerlayout/widget/DrawerLayout` | `[getDrawerLayout](https://developer.android.com/reference/androidx/navigation/ui/AppBarConfiguration#getDrawerLayout())()` **This method is deprecated.** Use {@link #getOpenableLayout()}. |
| `final https://developer.android.com/reference/androidx/navigation/ui/AppBarConfiguration.OnNavigateUpListener` | `https://developer.android.com/reference/androidx/navigation/ui/AppBarConfiguration#getFallbackOnNavigateUpListener()()` The `https://developer.android.com/reference/androidx/navigation/ui/AppBarConfiguration.OnNavigateUpListener` that should be invoked if `https://developer.android.com/reference/androidx/navigation/NavController#navigateUp()` returns `false`. |
| `final https://developer.android.com/reference/androidx/customview/widget/Openable` | `https://developer.android.com/reference/androidx/navigation/ui/AppBarConfiguration#getOpenableLayout()()` The `https://developer.android.com/reference/androidx/customview/widget/Openable` layout indicating that the Navigation button should be displayed as a drawer symbol when it is not being shown as an Up button. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Set.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Integer.html>` | `https://developer.android.com/reference/androidx/navigation/ui/AppBarConfiguration#getTopLevelDestinations()()` The set of destinations by id considered at the top level of your information hierarchy. |
| `final boolean` | `https://developer.android.com/reference/androidx/navigation/ui/AppBarConfiguration#isTopLevelDestination(androidx.navigation.NavDestination)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavDestination destination)` Determines whether a `https://developer.android.com/reference/androidx/navigation/NavDestination` is a top level destination in `https://developer.android.com/reference/androidx/navigation/ui/AppBarConfiguration`. |

## Public methods

### getDrawerLayout

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/navigation#1.0.0) Deprecated in [2.3.0](https://developer.android.com/jetpack/androidx/releases/navigation#2.3.0)

```
public final DrawerLayout [getDrawerLayout](https://developer.android.com/reference/androidx/navigation/ui/AppBarConfiguration#getDrawerLayout())()
```

> [!CAUTION]
> **This method is deprecated.**   
> Use {@link #getOpenableLayout()}.

The `https://developer.android.com/reference/androidx/drawerlayout/widget/DrawerLayout` indicating that the Navigation button should be displayed as a drawer symbol when it is not being shown as an Up button.

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/drawerlayout/widget/DrawerLayout` | The DrawerLayout that should be toggled from the Navigation button |

### getFallbackOnNavigateUpListener

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/navigation#1.0.0)

```
public final AppBarConfiguration.OnNavigateUpListener getFallbackOnNavigateUpListener()
```

The `https://developer.android.com/reference/androidx/navigation/ui/AppBarConfiguration.OnNavigateUpListener` that should be invoked if `https://developer.android.com/reference/androidx/navigation/NavController#navigateUp()` returns `false`.

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/navigation/ui/AppBarConfiguration.OnNavigateUpListener` | a `https://developer.android.com/reference/androidx/navigation/ui/AppBarConfiguration.OnNavigateUpListener` for providing custom up navigation logic, if one was set. |

### getOpenableLayout

Added in [2.3.0](https://developer.android.com/jetpack/androidx/releases/navigation#2.3.0)

```
public final Openable getOpenableLayout()
```

The `https://developer.android.com/reference/androidx/customview/widget/Openable` layout indicating that the Navigation button should be displayed as a drawer symbol when it is not being shown as an Up button.

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/customview/widget/Openable` | The Openable layout that should be toggled from the Navigation button |

### getTopLevelDestinations

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/navigation#1.0.0)

```
public final @NonNull Set<@NonNull Integer> getTopLevelDestinations()
```

The set of destinations by id considered at the top level of your information hierarchy. The Up button will not be displayed when on these destinations.

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Set.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Integer.html>` | The set of top level destinations by id. |

### isTopLevelDestination

Added in [2.6.0](https://developer.android.com/jetpack/androidx/releases/navigation#2.6.0)

```
public final boolean isTopLevelDestination(@NonNull NavDestination destination)
```

Determines whether a `https://developer.android.com/reference/androidx/navigation/NavDestination` is a top level destination in `https://developer.android.com/reference/androidx/navigation/ui/AppBarConfiguration`.

Returns true if the `https://developer.android.com/reference/androidx/navigation/NavDestination` was added directly as a top level destination via `https://developer.android.com/reference/androidx/navigation/ui/AppBarConfiguration.Builder` constructors such as `AppBarConfiguration.Builder(topLevelDestinationIds: Set<Int>)`. If destination was added with a `https://developer.android.com/reference/androidx/navigation/ui/AppBarConfiguration.Builder` that could take in a graph, i.e. `AppBarConfiguration.Builder(NavGraph)` or`AppBarConfiguration.Builder(Menu)`, this helper will return true if the destination is the start destination of a graph (including nested graphs i.e. `https://developer.android.com/reference/android/view/MenuItem.html` that are also `https://developer.android.com/reference/androidx/navigation/NavGraph`), or an individual `https://developer.android.com/reference/android/view/MenuItem.html` within the `https://developer.android.com/reference/android/view/Menu.html`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavDestination destination` | the `https://developer.android.com/reference/androidx/navigation/NavDestination` to check whether it is a topLevelDestination |