Class DynamicFABScrollBehavior
java.lang.Object
androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior<V>
com.google.android.material.appbar.AppBarLayout.ScrollingViewBehavior
com.pranavpandey.android.dynamic.support.behavior.DynamicFABScrollBehavior
A
FloatingActionButton
behavior to automatically show or hide it according to the
nested scroll. Set this behavior in the layout file having CoordinatorLayout
as root
element to show or hide the FAB according to the scroll direction.
Scrolling in upwards direction will hide the FAB and scrolling in downwards direction will make it visible.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
final int
int
boolean
boolean
protected void
layoutChild
(CoordinatorLayout arg0, View arg1, int arg2) boolean
layoutDependsOn
(CoordinatorLayout parent, View child, View dependency) boolean
onLayoutChild
(CoordinatorLayout arg0, View arg1, int arg2) boolean
onMeasureChild
(CoordinatorLayout arg0, View arg1, int arg2, int arg3, int arg4, int arg5) void
onNestedScroll
(CoordinatorLayout coordinatorLayout, View child, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int type, int[] consumed) boolean
onStartNestedScroll
(CoordinatorLayout coordinatorLayout, View child, View directTargetChild, View target, int nestedScrollAxes, int type) void
setHorizontalOffsetEnabled
(boolean arg0) boolean
setLeftAndRightOffset
(int arg0) final void
setOverlayTop
(int arg0) boolean
setTopAndBottomOffset
(int arg0) void
setVerticalOffsetEnabled
(boolean arg0) protected boolean
Methods inherited from class com.google.android.material.appbar.AppBarLayout.ScrollingViewBehavior
onDependentViewChanged, onDependentViewRemoved, onRequestChildRectangleOnScreen
Methods inherited from class androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior
blocksInteractionBelow, getInsetDodgeRect, getScrimColor, getScrimOpacity, getTag, onApplyWindowInsets, onAttachedToLayoutParams, onDetachedFromLayoutParams, onInterceptTouchEvent, onNestedFling, onNestedPreFling, onNestedPreScroll, onNestedPreScroll, onNestedScroll, onNestedScroll, onNestedScrollAccepted, onNestedScrollAccepted, onRestoreInstanceState, onSaveInstanceState, onStartNestedScroll, onStopNestedScroll, onStopNestedScroll, onTouchEvent, setTag
-
Constructor Details
-
DynamicFABScrollBehavior
-
-
Method Details
-
layoutDependsOn
- Overrides:
layoutDependsOn
in classAppBarLayout.ScrollingViewBehavior
-
onStartNestedScroll
public boolean onStartNestedScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull View child, @NonNull View directTargetChild, @NonNull View target, int nestedScrollAxes, int type) - Overrides:
onStartNestedScroll
in classCoordinatorLayout.Behavior<View>
-
onNestedScroll
public void onNestedScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull View child, @NonNull View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int type, @NonNull int[] consumed) - Overrides:
onNestedScroll
in classCoordinatorLayout.Behavior<View>
-
onMeasureChild
public boolean onMeasureChild(@NonNull CoordinatorLayout arg0, @NonNull View arg1, int arg2, int arg3, int arg4, int arg5) - Overrides:
onMeasureChild
in classCoordinatorLayout.Behavior<View>
-
layoutChild
-
shouldHeaderOverlapScrollingChild
protected boolean shouldHeaderOverlapScrollingChild() -
setOverlayTop
public final void setOverlayTop(int arg0) -
getOverlayTop
public final int getOverlayTop() -
onLayoutChild
- Overrides:
onLayoutChild
in classCoordinatorLayout.Behavior<V extends View>
-
setTopAndBottomOffset
public boolean setTopAndBottomOffset(int arg0) -
setLeftAndRightOffset
public boolean setLeftAndRightOffset(int arg0) -
getTopAndBottomOffset
public int getTopAndBottomOffset() -
getLeftAndRightOffset
public int getLeftAndRightOffset() -
setVerticalOffsetEnabled
public void setVerticalOffsetEnabled(boolean arg0) -
isVerticalOffsetEnabled
public boolean isVerticalOffsetEnabled() -
setHorizontalOffsetEnabled
public void setHorizontalOffsetEnabled(boolean arg0) -
isHorizontalOffsetEnabled
public boolean isHorizontalOffsetEnabled()
-