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

FloatingActionButtonDefaults

public static class FloatingActionButtonDefaults


Contains the default values used by FloatingActionButton

Summary

Public fields

static @NonNull FloatingActionButtonDefaults

Public methods

final @NonNull FloatingActionButtonElevation
bottomAppBarFabElevation(
    @NonNull Dp defaultElevation,
    @NonNull Dp pressedElevation,
    @NonNull Dp focusedElevation,
    @NonNull Dp hoveredElevation
)

Use this to create a FloatingActionButton that represents the default elevation of a FloatingActionButton used for BottomAppBar in different states.

final @NonNull FloatingActionButtonElevation
@Composable
elevation(
    @NonNull Dp defaultElevation,
    @NonNull Dp pressedElevation,
    @NonNull Dp focusedElevation,
    @NonNull Dp hoveredElevation
)

Creates a FloatingActionButtonElevation that represents the elevation of a FloatingActionButton in different states.

final @NonNull Color

Default container color for a floating action button.

final @NonNull Shape

Default shape for an extended floating action button.

final @NonNull Dp

The recommended size of the icon inside a LargeFloatingActionButton.

final @NonNull Shape

Default shape for a large floating action button.

final @NonNull Shape

Default shape for a floating action button.

final @NonNull Shape

Default shape for a small floating action button.

final @NonNull FloatingActionButtonElevation
@Composable
loweredElevation(
    @NonNull Dp defaultElevation,
    @NonNull Dp pressedElevation,
    @NonNull Dp focusedElevation,
    @NonNull Dp hoveredElevation
)

Use this to create a FloatingActionButton with a lowered elevation for less emphasis.

Public fields

INSTANCE

public static @NonNull FloatingActionButtonDefaults INSTANCE

Public methods

bottomAppBarFabElevation

public final @NonNull FloatingActionButtonElevation bottomAppBarFabElevation(
    @NonNull Dp defaultElevation,
    @NonNull Dp pressedElevation,
    @NonNull Dp focusedElevation,
    @NonNull Dp hoveredElevation
)

Use this to create a FloatingActionButton that represents the default elevation of a FloatingActionButton used for BottomAppBar in different states.

Parameters
@NonNull Dp defaultElevation

the elevation used when the FloatingActionButton has no other Interactions.

@NonNull Dp pressedElevation

the elevation used when the FloatingActionButton is pressed.

@NonNull Dp focusedElevation

the elevation used when the FloatingActionButton is focused.

@NonNull Dp hoveredElevation

the elevation used when the FloatingActionButton is hovered.

elevation

@Composable
public final @NonNull FloatingActionButtonElevation elevation(
    @NonNull Dp defaultElevation,
    @NonNull Dp pressedElevation,
    @NonNull Dp focusedElevation,
    @NonNull Dp hoveredElevation
)

Creates a FloatingActionButtonElevation that represents the elevation of a FloatingActionButton in different states. For use cases in which a less prominent FloatingActionButton is possible consider the loweredElevation.

Parameters
@NonNull Dp defaultElevation

the elevation used when the FloatingActionButton has no other Interactions.

@NonNull Dp pressedElevation

the elevation used when the FloatingActionButton is pressed.

@NonNull Dp focusedElevation

the elevation used when the FloatingActionButton is focused.

@NonNull Dp hoveredElevation

the elevation used when the FloatingActionButton is hovered.

getContainerColor

@Composable
public final @NonNull Color getContainerColor()

Default container color for a floating action button.

getExtendedFabShape

@Composable
public final @NonNull Shape getExtendedFabShape()

Default shape for an extended floating action button.

getLargeIconSize

public final @NonNull Dp getLargeIconSize()

The recommended size of the icon inside a LargeFloatingActionButton.

getLargeShape

@Composable
public final @NonNull Shape getLargeShape()

Default shape for a large floating action button.

getShape

@Composable
public final @NonNull Shape getShape()

Default shape for a floating action button.

getSmallShape

@Composable
public final @NonNull Shape getSmallShape()

Default shape for a small floating action button.

loweredElevation

@Composable
public final @NonNull FloatingActionButtonElevation loweredElevation(
    @NonNull Dp defaultElevation,
    @NonNull Dp pressedElevation,
    @NonNull Dp focusedElevation,
    @NonNull Dp hoveredElevation
)

Use this to create a FloatingActionButton with a lowered elevation for less emphasis. Use elevation to get a normal FloatingActionButton.

Parameters
@NonNull Dp defaultElevation

the elevation used when the FloatingActionButton has no other Interactions.

@NonNull Dp pressedElevation

the elevation used when the FloatingActionButton is pressed.

@NonNull Dp focusedElevation

the elevation used when the FloatingActionButton is focused.

@NonNull Dp hoveredElevation

the elevation used when the FloatingActionButton is hovered.