FloatingActionButton.Behavior


Kotlin |Java

public class FloatingActionButton.Behavior extends FloatingActionButton.BaseBehavior 


Behavior designed for use with FloatingActionButton instances. Its main function is to move FloatingActionButton views so that any displayed com.google.android.material.snackbar.Snackbar s do not cover them.

Summary

Public constructors

Behavior(Context context, AttributeSet attrs)
boolean
getInsetDodgeRect(
CoordinatorLayout parent,
FloatingActionButton child,
Rect rect
)
boolean

Returns whether the associated FloatingActionButton automatically hides when there is not enough space to be displayed.

void
onAttachedToLayoutParams(LayoutParams lp)
boolean
onDependentViewChanged(
CoordinatorLayout parent,
FloatingActionButton child,
View dependency
)
boolean
onLayoutChild(
CoordinatorLayout parent,
FloatingActionButton child,
int layoutDirection
)
void
setAutoHideEnabled(boolean autoHide)

Sets whether the associated FloatingActionButton automatically hides when there is not enough space to be displayed.

Inherited methods

From com.google.android.material.floatingactionbutton.FloatingActionButton.BaseBehavior

Public constructors

Behavior

public Behavior()

Behavior

public Behavior(Context context, AttributeSet attrs)

Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Last updated 2026年05月14日 UTC.