The Android Developer Challenge is back! Submit your idea before December 2.

ExtendedFloatingActionButton.ExtendedFloatingActionButtonBehavior

protected static class ExtendedFloatingActionButton.ExtendedFloatingActionButtonBehavior
extends Behavior<T extends ExtendedFloatingActionButton>

java.lang.Object
   ↳ androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior<T extends com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton>
     ↳ com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton.ExtendedFloatingActionButtonBehavior<T extends com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton>


Behavior designed for use with ExtendedFloatingActionButton instances. Its main function is to move ExtendedFloatingActionButton views so that any displayed Snackbars do not cover them.

Summary

XML attributes

ExtendedFloatingActionButton_Behavior_Layout_behavior_autoHide  
ExtendedFloatingActionButton_Behavior_Layout_behavior_autoShrink  

Public constructors

ExtendedFloatingActionButton.ExtendedFloatingActionButtonBehavior()
ExtendedFloatingActionButton.ExtendedFloatingActionButtonBehavior(Context context, AttributeSet attrs)

Public methods

boolean getInsetDodgeRect(CoordinatorLayout parent, ExtendedFloatingActionButton child, Rect rect)
boolean isAutoHideEnabled()

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

boolean isAutoShrinkEnabled()

Returns whether the associated ExtendedFloatingActionButton automatically shrinks when there is not enough space to be displayed.

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

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

void setAutoShrinkEnabled(boolean autoShrink)

Sets whether the associated ExtendedFloatingActionButton automatically shrink when there is not enough space to be displayed.

Protected methods

void extendOrShow(ExtendedFloatingActionButton fab)

Extends the Extended FAB, in case auto-shrink is enabled, or show it in case auto-hide is enabled.

void shrinkOrHide(ExtendedFloatingActionButton fab)

Shrinks the Extended FAB, in case auto-shrink is enabled, or hides it in case auto-hide is enabled.

Inherited methods

From class androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior
From class java.lang.Object

XML attributes

ExtendedFloatingActionButton_Behavior_Layout_behavior_autoHide

Related methods:

ExtendedFloatingActionButton_Behavior_Layout_behavior_autoShrink

Related methods:

Public constructors

ExtendedFloatingActionButton.ExtendedFloatingActionButtonBehavior

ExtendedFloatingActionButton.ExtendedFloatingActionButtonBehavior ()

ExtendedFloatingActionButton.ExtendedFloatingActionButtonBehavior

ExtendedFloatingActionButton.ExtendedFloatingActionButtonBehavior (Context context, 
                AttributeSet attrs)

Parameters
context Context

attrs AttributeSet

Public methods

getInsetDodgeRect

boolean getInsetDodgeRect (CoordinatorLayout parent, 
                ExtendedFloatingActionButton child, 
                Rect rect)

Parameters
parent CoordinatorLayout

child ExtendedFloatingActionButton

rect Rect

Returns
boolean

isAutoHideEnabled

boolean isAutoHideEnabled ()

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

Related XML Attributes:

Returns
boolean true if enabled

isAutoShrinkEnabled

boolean isAutoShrinkEnabled ()

Returns whether the associated ExtendedFloatingActionButton automatically shrinks when there is not enough space to be displayed.

Related XML Attributes:

Returns
boolean true if enabled

onAttachedToLayoutParams

void onAttachedToLayoutParams (CoordinatorLayout.LayoutParams lp)

Parameters
lp CoordinatorLayout.LayoutParams

onDependentViewChanged

boolean onDependentViewChanged (CoordinatorLayout parent, 
                ExtendedFloatingActionButton child, 
                View dependency)

Parameters
parent CoordinatorLayout

child ExtendedFloatingActionButton

dependency View

Returns
boolean

onLayoutChild

boolean onLayoutChild (CoordinatorLayout parent, 
                ExtendedFloatingActionButton child, 
                int layoutDirection)

Parameters
parent CoordinatorLayout

child ExtendedFloatingActionButton

layoutDirection int

Returns
boolean

setAutoHideEnabled

void setAutoHideEnabled (boolean autoHide)

Sets whether the associated ExtendedFloatingActionButton automatically hides when there is not enough space to be displayed. This works with AppBarLayout and BottomSheetBehavior.

In case auto-shrink is enabled, it will take precedence over the auto-hide option.

Related XML Attributes:

Parameters
autoHide boolean: true to enable automatic hiding

setAutoShrinkEnabled

void setAutoShrinkEnabled (boolean autoShrink)

Sets whether the associated ExtendedFloatingActionButton automatically shrink when there is not enough space to be displayed. This works with AppBarLayout and BottomSheetBehavior.

Related XML Attributes:

Parameters
autoShrink boolean: true to enable automatic shrinking

Protected methods

extendOrShow

void extendOrShow (ExtendedFloatingActionButton fab)

Extends the Extended FAB, in case auto-shrink is enabled, or show it in case auto-hide is enabled. The priority is given to the default extend option, and the button will be shown only when the auto-shrink is false and auto-hide is true.

Related XML Attributes:

Parameters
fab ExtendedFloatingActionButton

shrinkOrHide

void shrinkOrHide (ExtendedFloatingActionButton fab)

Shrinks the Extended FAB, in case auto-shrink is enabled, or hides it in case auto-hide is enabled. The priority is given to the default shrink option, and the button will be hidden only when the auto-shrink is false and auto-hide is true.

Related XML Attributes:

Parameters
fab ExtendedFloatingActionButton