ExtendedFloatingActionButton.ExtendedFloatingActionButtonBehavior

protected class ExtendedFloatingActionButton.ExtendedFloatingActionButtonBehavior<T extends ExtendedFloatingActionButton>


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

Summary

Public constructors

ExtendedFloatingActionButtonBehavior(
    Context context,
    AttributeSet attrs
)

Public methods

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

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

boolean

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

void
onAttachedToLayoutParams(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

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

void

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

Public constructors

ExtendedFloatingActionButtonBehavior

public ExtendedFloatingActionButtonBehavior()

ExtendedFloatingActionButtonBehavior

public ExtendedFloatingActionButtonBehavior(
    Context context,
    AttributeSet attrs
)

Public methods

getInsetDodgeRect

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

isAutoHideEnabled

public boolean isAutoHideEnabled()

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

ref com.google.android.material.R.styleable#ExtendedFloatingActionButton_Behavior_Layout_behavior_autoHide

Returns
boolean

true if enabled

isAutoShrinkEnabled

public boolean isAutoShrinkEnabled()

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

ref com.google.android.material.R.styleable#ExtendedFloatingActionButton_Behavior_Layout_behavior_autoShrink

Returns
boolean

true if enabled

onAttachedToLayoutParams

public void onAttachedToLayoutParams(LayoutParams lp)

onDependentViewChanged

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

onLayoutChild

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

setAutoHideEnabled

public 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 .

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

ref com.google.android.material.R.styleable#ExtendedFloatingActionButton_Behavior_Layout_behavior_autoHide

Parameters
boolean autoHide

true to enable automatic hiding

setAutoShrinkEnabled

public 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 .

ref com.google.android.material.R.styleable#ExtendedFloatingActionButton_Behavior_Layout_behavior_autoShrink

Parameters
boolean autoShrink

true to enable automatic shrinking

Protected methods

extendOrShow

protected 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.

ref com.google.android.material.R.styleable#ExtendedFloatingActionButton_Behavior_Layout_behavior_autoShrink

ref com.google.android.material.R.styleable#ExtendedFloatingActionButton_Behavior_Layout_behavior_autoHide

shrinkOrHide

protected 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.

ref com.google.android.material.R.styleable#ExtendedFloatingActionButton_Behavior_Layout_behavior_autoShrink

ref com.google.android.material.R.styleable#ExtendedFloatingActionButton_Behavior_Layout_behavior_autoHide