AppBarLayout.LayoutParams
public
static
class
AppBarLayout.LayoutParams
extends LinearLayout.LayoutParams
java.lang.Object | ||||
↳ | android.view.ViewGroup.LayoutParams | |||
↳ | android.view.ViewGroup.MarginLayoutParams | |||
↳ | android.widget.LinearLayout.LayoutParams | |||
↳ | com.google.android.material.appbar.AppBarLayout.LayoutParams |
A ViewGroup.LayoutParams
implementation for AppBarLayout
.
Summary
XML attributes | |
---|---|
AppBarLayout_Layout_layout_scrollFlags |
|
AppBarLayout_Layout_layout_scrollInterpolator |
Constants | |
---|---|
int |
SCROLL_EFFECT_COMPRESS
An effect that will "compress" this view as it hits the scroll ceiling (typically the top of the screen). |
int |
SCROLL_EFFECT_NONE
No effect should be placed on this view. |
int |
SCROLL_FLAG_ENTER_ALWAYS
When entering (scrolling on screen) the view will scroll on any downwards scroll event, regardless of whether the scrolling view is also scrolling. |
int |
SCROLL_FLAG_ENTER_ALWAYS_COLLAPSED
An additional flag for 'enterAlways' which modifies the returning view to only initially scroll back to it's collapsed height. |
int |
SCROLL_FLAG_EXIT_UNTIL_COLLAPSED
When exiting (scrolling off screen) the view will be scrolled until it is 'collapsed'. |
int |
SCROLL_FLAG_NO_SCROLL
Disable scrolling on the view. |
int |
SCROLL_FLAG_SCROLL
The view will be scroll in direct relation to scroll events. |
int |
SCROLL_FLAG_SNAP
Upon a scroll ending, if the view is only partially visible then it will be snapped and scrolled to its closest edge. |
int |
SCROLL_FLAG_SNAP_MARGINS
An additional flag to be used with 'snap'. |
Inherited constants |
---|
Inherited fields |
---|
Public constructors | |
---|---|
LayoutParams(Context c, AttributeSet attrs)
|
|
LayoutParams(int width, int height)
|
|
LayoutParams(int width, int height, float weight)
|
|
LayoutParams(ViewGroup.LayoutParams p)
|
|
LayoutParams(ViewGroup.MarginLayoutParams source)
|
|
LayoutParams(LinearLayout.LayoutParams source)
|
|
LayoutParams(AppBarLayout.LayoutParams source)
|
Public methods | |
---|---|
AppBarLayout.ChildScrollEffect
|
getScrollEffect()
Get the scroll effect to be applied when the AppBarLayout's offset changes |
int
|
getScrollFlags()
Returns the scrolling flags. |
Interpolator
|
getScrollInterpolator()
Returns the |
void
|
setScrollEffect(AppBarLayout.ChildScrollEffect scrollEffect)
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 |
Inherited methods | |
---|---|
XML attributes
AppBarLayout_Layout_layout_scrollFlags
Related methods:
AppBarLayout_Layout_layout_scrollInterpolator
Related methods:
Constants
SCROLL_EFFECT_COMPRESS
public static final int SCROLL_EFFECT_COMPRESS
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.
Constant Value: 1 (0x00000001)
SCROLL_EFFECT_NONE
public static final int SCROLL_EFFECT_NONE
No effect should be placed on this view. It will scroll 1:1 with the AppBarLayout/scrolling content.
Constant Value: 0 (0x00000000)
SCROLL_FLAG_ENTER_ALWAYS
public static final int SCROLL_FLAG_ENTER_ALWAYS
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.
Constant Value: 4 (0x00000004)
SCROLL_FLAG_ENTER_ALWAYS_COLLAPSED
public static final int SCROLL_FLAG_ENTER_ALWAYS_COLLAPSED
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.
Constant Value: 8 (0x00000008)
SCROLL_FLAG_EXIT_UNTIL_COLLAPSED
public static final int SCROLL_FLAG_EXIT_UNTIL_COLLAPSED
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.
Constant Value: 2 (0x00000002)
SCROLL_FLAG_NO_SCROLL
public static final int SCROLL_FLAG_NO_SCROLL
Disable scrolling on the view. This flag should not be combined with any of the other scroll flags.
Constant Value: 0 (0x00000000)
SCROLL_FLAG_SCROLL
public static final int SCROLL_FLAG_SCROLL
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.
Constant Value: 1 (0x00000001)
SCROLL_FLAG_SNAP
public static final int SCROLL_FLAG_SNAP
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.
Constant Value: 16 (0x00000010)
SCROLL_FLAG_SNAP_MARGINS
public static final int SCROLL_FLAG_SNAP_MARGINS
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.
Constant Value: 32 (0x00000020)
Public constructors
LayoutParams
public LayoutParams (Context c, AttributeSet attrs)
Parameters | |
---|---|
c |
Context |
attrs |
AttributeSet |
LayoutParams
public LayoutParams (int width, int height)
Parameters | |
---|---|
width |
int |
height |
int |
LayoutParams
public LayoutParams (int width, int height, float weight)
Parameters | |
---|---|
width |
int |
height |
int |
weight |
float |
LayoutParams
public LayoutParams (ViewGroup.LayoutParams p)
Parameters | |
---|---|
p |
ViewGroup.LayoutParams |
LayoutParams
public LayoutParams (ViewGroup.MarginLayoutParams source)
Parameters | |
---|---|
source |
ViewGroup.MarginLayoutParams |
LayoutParams
public LayoutParams (LinearLayout.LayoutParams source)
Parameters | |
---|---|
source |
LinearLayout.LayoutParams |
LayoutParams
public LayoutParams (AppBarLayout.LayoutParams source)
Parameters | |
---|---|
source |
AppBarLayout.LayoutParams |
Public methods
getScrollEffect
public AppBarLayout.ChildScrollEffect getScrollEffect ()
Get the scroll effect to be applied when the AppBarLayout's offset changes
Returns | |
---|---|
AppBarLayout.ChildScrollEffect |
getScrollFlags
public int getScrollFlags ()
Returns the scrolling flags.
Related XML Attributes:
Returns | |
---|---|
int |
See also:
getScrollInterpolator
public Interpolator getScrollInterpolator ()
Returns the Interpolator
being used for scrolling the view associated with this
AppBarLayout.LayoutParams
. Null indicates 'normal' 1-to-1 scrolling.
Related XML Attributes:
Returns | |
---|---|
Interpolator |
See also:
setScrollEffect
public void setScrollEffect (AppBarLayout.ChildScrollEffect scrollEffect)
Set the scroll effect to be applied when the AppBarLayout's offset changes.
Parameters | |
---|---|
scrollEffect |
AppBarLayout.ChildScrollEffect : 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 | |
---|---|
scrollEffect |
int : 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.
Related XML Attributes:
Parameters | |
---|---|
flags |
int : bitwise int of SCROLL_FLAG_SCROLL , SCROLL_FLAG_EXIT_UNTIL_COLLAPSED , SCROLL_FLAG_ENTER_ALWAYS , SCROLL_FLAG_ENTER_ALWAYS_COLLAPSED , SCROLL_FLAG_SNAP , and SCROLL_FLAG_SNAP_MARGINS . Otherwise, use SCROLL_FLAG_NO_SCROLL to disable
scrolling. |
See also:
setScrollInterpolator
public void setScrollInterpolator (Interpolator interpolator)
Set the interpolator to when scrolling the view associated with this AppBarLayout.LayoutParams
.
Related XML Attributes:
Parameters | |
---|---|
interpolator |
Interpolator : the interpolator to use, or null to use normal 1-to-1 scrolling. |
See also:
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 2023-01-25 UTC.