{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

BottomAppBarState

@ExperimentalMaterial3Api
public interface BottomAppBarState


A state object that can be hoisted to control and observe the bottom app bar state. The state is read and updated by a BottomAppBarScrollBehavior implementation.

In most cases, this state will be created via rememberBottomAppBarState.

Summary

Nested types

public static class BottomAppBarState.Companion

Public methods

abstract float

A value that represents the collapsed height percentage of the app bar.

abstract float

The total offset of the content scrolled under the bottom app bar.

abstract float

The bottom app bar's current height offset in pixels.

abstract float

The bottom app bar's height offset limit in pixels, which represents the limit that a bottom app bar is allowed to collapse to.

abstract void
setContentOffset(float contentOffset)

The total offset of the content scrolled under the bottom app bar.

abstract void
setHeightOffset(float heightOffset)

The bottom app bar's current height offset in pixels.

abstract void
setHeightOffsetLimit(float heightOffsetLimit)

The bottom app bar's height offset limit in pixels, which represents the limit that a bottom app bar is allowed to collapse to.

Public methods

getCollapsedFraction

abstract float getCollapsedFraction()

A value that represents the collapsed height percentage of the app bar.

A 0.0 represents a fully expanded bar, and 1.0 represents a fully collapsed bar (computed as heightOffset / heightOffsetLimit).

getContentOffset

abstract float getContentOffset()

The total offset of the content scrolled under the bottom app bar.

This value is updated by a BottomAppBarScrollBehavior whenever a nested scroll connection consumes scroll events. A common implementation would update the value to be the sum of all NestedScrollConnection.onPostScroll consumed.y values.

getHeightOffset

abstract float getHeightOffset()

The bottom app bar's current height offset in pixels. This height offset is applied to the fixed height of the app bar to control the displayed height when content is being scrolled.

Updates to the heightOffset value are coerced between zero and heightOffsetLimit.

getHeightOffsetLimit

abstract float getHeightOffsetLimit()

The bottom app bar's height offset limit in pixels, which represents the limit that a bottom app bar is allowed to collapse to.

Use this limit to coerce the heightOffset value when it's updated.

setContentOffset

abstract void setContentOffset(float contentOffset)

The total offset of the content scrolled under the bottom app bar.

This value is updated by a BottomAppBarScrollBehavior whenever a nested scroll connection consumes scroll events. A common implementation would update the value to be the sum of all NestedScrollConnection.onPostScroll consumed.y values.

setHeightOffset

abstract void setHeightOffset(float heightOffset)

The bottom app bar's current height offset in pixels. This height offset is applied to the fixed height of the app bar to control the displayed height when content is being scrolled.

Updates to the heightOffset value are coerced between zero and heightOffsetLimit.

setHeightOffsetLimit

abstract void setHeightOffsetLimit(float heightOffsetLimit)

The bottom app bar's height offset limit in pixels, which represents the limit that a bottom app bar is allowed to collapse to.

Use this limit to coerce the heightOffset value when it's updated.