AppBarLayout.LayoutParams

public class AppBarLayout.LayoutParams


A ViewGroup.LayoutParams implementation for AppBarLayout.

Summary

Constants

static final int

An effect that will "compress" this view as it hits the scroll ceiling (typically the top of the screen).

static final int

No effect should be placed on this view.

static final int

When entering (scrolling on screen) the view will scroll on any downwards scroll event, regardless of whether the scrolling view is also scrolling.

static final int

An additional flag for 'enterAlways' which modifies the returning view to only initially scroll back to it's collapsed height.

static final int

When exiting (scrolling off screen) the view will be scrolled until it is 'collapsed'.

static final int

Disable scrolling on the view.

static final int

The view will be scroll in direct relation to scroll events.

static final int

Upon a scroll ending, if the view is only partially visible then it will be snapped and scrolled to its closest edge.

static final int

An additional flag to be used with 'snap'.

Public constructors

LayoutParams(LayoutParams p)
LayoutParams(LayoutParams source)
LayoutParams(MarginLayoutParams source)
LayoutParams(Context c, AttributeSet attrs)
LayoutParams(int width, int height)
LayoutParams(int width, int height, float weight)

Public methods

AppBarLayout.ChildScrollEffect

Get the scroll effect to be applied when the AppBarLayout's offset changes

int

Returns the scrolling flags.

Interpolator

Returns the Interpolator being used for scrolling the view associated with this LayoutParams.

void

Set the scroll effect to be applied when the AppBarLayout's offset changes.

void
setScrollEffect(int scrollEffect)

Set the scroll effect to be applied when the AppBarLayout's offset changes.

void
setScrollFlags(int flags)

Set the scrolling flags.

void
setScrollInterpolator(Interpolator interpolator)

Set the interpolator to when scrolling the view associated with this LayoutParams.

Constants

SCROLL_EFFECT_COMPRESS

public static final int SCROLL_EFFECT_COMPRESS = 1

An effect that will "compress" this view as it hits the scroll ceiling (typically the top of the screen). This is a parallax effect that masks this view and decreases its scroll ratio in relation to the AppBarLayout's offset.

SCROLL_EFFECT_NONE

public static final int SCROLL_EFFECT_NONE = 0

No effect should be placed on this view. It will scroll 1:1 with the AppBarLayout/scrolling content.

SCROLL_FLAG_ENTER_ALWAYS

public static final int SCROLL_FLAG_ENTER_ALWAYS = 4

When entering (scrolling on screen) the view will scroll on any downwards scroll event, regardless of whether the scrolling view is also scrolling. This is commonly referred to as the 'quick return' pattern.

SCROLL_FLAG_ENTER_ALWAYS_COLLAPSED

public static final int SCROLL_FLAG_ENTER_ALWAYS_COLLAPSED = 8

An additional flag for 'enterAlways' which modifies the returning view to only initially scroll back to it's collapsed height. Once the scrolling view has reached the end of it's scroll range, the remainder of this view will be scrolled into view. The collapsed height is defined by the view's minimum height.

See also
View
View

SCROLL_FLAG_EXIT_UNTIL_COLLAPSED

public static final int SCROLL_FLAG_EXIT_UNTIL_COLLAPSED = 2

When exiting (scrolling off screen) the view will be scrolled until it is 'collapsed'. The collapsed height is defined by the view's minimum height.

See also
View
View

SCROLL_FLAG_NO_SCROLL

public static final int SCROLL_FLAG_NO_SCROLL = 0

Disable scrolling on the view. This flag should not be combined with any of the other scroll flags.

SCROLL_FLAG_SCROLL

public static final int SCROLL_FLAG_SCROLL = 1

The view will be scroll in direct relation to scroll events. This flag needs to be set for any of the other flags to take effect. If any sibling views before this one do not have this flag, then this value has no effect.

SCROLL_FLAG_SNAP

public static final int SCROLL_FLAG_SNAP = 16

Upon a scroll ending, if the view is only partially visible then it will be snapped and scrolled to its closest edge. For example, if the view only has its bottom 25% displayed, it will be scrolled off screen completely. Conversely, if its bottom 75% is visible then it will be scrolled fully into view.

SCROLL_FLAG_SNAP_MARGINS

public static final int SCROLL_FLAG_SNAP_MARGINS = 32

An additional flag to be used with 'snap'. If set, the view will be snapped to its top and bottom margins, as opposed to the edges of the view itself.

Public fields

scrollFlags

public int scrollFlags

scrollInterpolator

public Interpolator scrollInterpolator

Public constructors

LayoutParams

public LayoutParams(LayoutParams p)

LayoutParams

public LayoutParams(AppBarLayout.LayoutParams source)

LayoutParams

public LayoutParams(LayoutParams source)

LayoutParams

public LayoutParams(MarginLayoutParams source)

LayoutParams

public LayoutParams(Context c, AttributeSet attrs)

LayoutParams

public LayoutParams(int width, int height)

LayoutParams

public LayoutParams(int width, int height, float weight)

Public methods

getScrollEffect

public AppBarLayout.ChildScrollEffect getScrollEffect()

Get the scroll effect to be applied when the AppBarLayout's offset changes

getScrollFlags

public int getScrollFlags()

Returns the scrolling flags.

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

See also
setScrollFlags

getScrollInterpolator

public Interpolator getScrollInterpolator()

Returns the Interpolator being used for scrolling the view associated with this LayoutParams. Null indicates 'normal' 1-to-1 scrolling.

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

setScrollEffect

public void setScrollEffect(AppBarLayout.ChildScrollEffect scrollEffect)

Set the scroll effect to be applied when the AppBarLayout's offset changes.

Parameters
AppBarLayout.ChildScrollEffect scrollEffect

An AppBarLayoutChildScrollEffect implementation. If null is passed, the scroll effect will be cleared and no effect will be applied.

setScrollEffect

public void setScrollEffect(int scrollEffect)

Set the scroll effect to be applied when the AppBarLayout's offset changes.

Parameters
int scrollEffect

An AppBarLayoutChildScrollEffect implementation. If SCROLL_EFFECT_NONE is passed, the scroll effect will be cleared and no effect will be applied.

setScrollFlags

public void setScrollFlags(int flags)

Set the scrolling flags.

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

See also
getScrollFlags

setScrollInterpolator

public void setScrollInterpolator(Interpolator interpolator)

Set the interpolator to when scrolling the view associated with this LayoutParams.

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

Parameters
Interpolator interpolator

the interpolator to use, or null to use normal 1-to-1 scrolling.