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 Snackbar
s do not cover them.
Summary
XML attributes | |
---|---|
ExtendedFloatingActionButton_Behavior_Layout_behavior_autoHide |
|
ExtendedFloatingActionButton_Behavior_Layout_behavior_autoShrink |
Public constructors | |
---|---|
ExtendedFloatingActionButtonBehavior()
|
|
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 | |
---|---|
XML attributes
ExtendedFloatingActionButton_Behavior_Layout_behavior_autoHide
Related methods:
ExtendedFloatingActionButton_Behavior_Layout_behavior_autoShrink
Related methods:
Public constructors
ExtendedFloatingActionButtonBehavior
public ExtendedFloatingActionButtonBehavior ()
ExtendedFloatingActionButtonBehavior
public ExtendedFloatingActionButtonBehavior (Context context, AttributeSet attrs)
Parameters | |
---|---|
context |
Context |
attrs |
AttributeSet |
Public methods
getInsetDodgeRect
public boolean getInsetDodgeRect (CoordinatorLayout parent, ExtendedFloatingActionButton child, Rect rect)
Parameters | |
---|---|
parent |
CoordinatorLayout |
child |
ExtendedFloatingActionButton |
rect |
Rect |
Returns | |
---|---|
boolean |
isAutoHideEnabled
public 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
public 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
public void onAttachedToLayoutParams (CoordinatorLayout.LayoutParams lp)
Parameters | |
---|---|
lp |
CoordinatorLayout.LayoutParams |
onDependentViewChanged
public boolean onDependentViewChanged (CoordinatorLayout parent, ExtendedFloatingActionButton child, View dependency)
Parameters | |
---|---|
parent |
CoordinatorLayout |
child |
ExtendedFloatingActionButton |
dependency |
View |
Returns | |
---|---|
boolean |
onLayoutChild
public boolean onLayoutChild (CoordinatorLayout parent, ExtendedFloatingActionButton child, int layoutDirection)
Parameters | |
---|---|
parent |
CoordinatorLayout |
child |
ExtendedFloatingActionButton |
layoutDirection |
int |
Returns | |
---|---|
boolean |
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 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
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 BottomSheetBehavior
.
Related XML Attributes:
Parameters | |
---|---|
autoShrink |
boolean : 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
.
Related XML Attributes:
- ExtendedFloatingActionButton_Behavior_Layout_behavior_autoShrink
- ExtendedFloatingActionButton_Behavior_Layout_behavior_autoHide
Parameters | |
---|---|
fab |
ExtendedFloatingActionButton |
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
.
Related XML Attributes:
- ExtendedFloatingActionButton_Behavior_Layout_behavior_autoShrink
- ExtendedFloatingActionButton_Behavior_Layout_behavior_autoHide
Parameters | |
---|---|
fab |
ExtendedFloatingActionButton |
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 2021-02-08 UTC.