# AppBarLayout.LayoutParams

[View Source](https://github.com/material-components/material-components-android/blob/1.14.0/lib/java/com/google/android/material/appbar/AppBarLayout.java)

*** ** * ** ***


```
public class AppBarLayout.LayoutParams
```

<br />

*** ** * ** ***

A ViewGroup.LayoutParams implementation for `https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout`.

## Summary

| ### Constants |
|---|---|
| `static final int` | `https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.LayoutParams#SCROLL_EFFECT_COMPRESS() = 1` An effect that will "compress" this view as it hits the scroll ceiling (typically the top of the screen). |
| `static final int` | `https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.LayoutParams#SCROLL_EFFECT_NONE() = 0` No effect should be placed on this view. |
| `static final int` | `https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.LayoutParams#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. |
| `static final int` | `https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.LayoutParams#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. |
| `static final int` | `https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.LayoutParams#SCROLL_FLAG_EXIT_UNTIL_COLLAPSED() = 2` When exiting (scrolling off screen) the view will be scrolled until it is 'collapsed'. |
| `static final int` | `https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.LayoutParams#SCROLL_FLAG_NO_SCROLL() = 0` Disable scrolling on the view. |
| `static final int` | `https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.LayoutParams#SCROLL_FLAG_SCROLL() = 1` The view will be scroll in direct relation to scroll events. |
| `static final int` | `https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.LayoutParams#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. |
| `static final int` | `https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.LayoutParams#SCROLL_FLAG_SNAP_MARGINS() = 32` An additional flag to be used with 'snap'. |

| ### Public fields |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.ChildScrollEffect` | `https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.LayoutParams#scrollEffect()` |
| `int` | `https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.LayoutParams#scrollFlags()` |
| `Interpolator` | `https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.LayoutParams#scrollInterpolator()` |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.LayoutParams#LayoutParams(ViewGroup.LayoutParams)(LayoutParams p)` |
| `https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.LayoutParams#LayoutParams(com.google.android.material.appbar.AppBarLayout.LayoutParams)(https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.LayoutParams source)` |
| `https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.LayoutParams#LayoutParams(LinearLayout.LayoutParams)(LayoutParams source)` |
| `https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.LayoutParams#LayoutParams(MarginLayoutParams)(MarginLayoutParams source)` |
| `https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.LayoutParams#LayoutParams(Context,AttributeSet)(Context c, AttributeSet attrs)` |
| `https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.LayoutParams#LayoutParams(int,int)(int width, int height)` |
| `https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.LayoutParams#LayoutParams(int,int,float)(int width, int height, float weight)` |

| ### Public methods |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.ChildScrollEffect` | `https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.LayoutParams#getScrollEffect()()` Get the scroll effect to be applied when the AppBarLayout's offset changes |
| `int` | `https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.LayoutParams#getScrollFlags()()` Returns the scrolling flags. |
| `Interpolator` | `https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.LayoutParams#getScrollInterpolator()()` Returns the Interpolator being used for scrolling the view associated with this `https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.LayoutParams`. |
| `void` | `https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.LayoutParams#setScrollEffect(com.google.android.material.appbar.AppBarLayout.ChildScrollEffect)(https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.ChildScrollEffect scrollEffect)` Set the scroll effect to be applied when the AppBarLayout's offset changes. |
| `void` | `https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.LayoutParams#setScrollEffect(int)(int scrollEffect)` Set the scroll effect to be applied when the AppBarLayout's offset changes. |
| `void` | `https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.LayoutParams#setScrollFlags(int)(int flags)` Set the scrolling flags. |
| `void` | `https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.LayoutParams#setScrollInterpolator(Interpolator)(Interpolator interpolator)` Set the interpolator to when scrolling the view associated with this `https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.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 |
|---|---|
| `https://developer.android.com/reference/View#getMinimumHeight()` |   |
| `https://developer.android.com/reference/View#setMinimumHeight(int)` |   |

### 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 |
|---|---|
| `https://developer.android.com/reference/View#getMinimumHeight()` |   |
| `https://developer.android.com/reference/View#setMinimumHeight(int)` |   |

### 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

### scrollEffect

```
public AppBarLayout.ChildScrollEffect scrollEffect
```

### 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 |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.LayoutParams#setScrollFlags(int)` |   |

### getScrollInterpolator

```
public Interpolator getScrollInterpolator()
```

Returns the Interpolator being used for scrolling the view associated with this `https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.LayoutParams`. Null indicates 'normal' 1-to-1 scrolling.

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

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.LayoutParams#setScrollInterpolator(Interpolator)` |   |

### setScrollEffect

```
public void setScrollEffect(AppBarLayout.ChildScrollEffect scrollEffect)
```

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

| Parameters |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/appbar/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 `https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.LayoutParams#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

| Parameters |
|---|---|
| `int flags` | bitwise int of `https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.LayoutParams#SCROLL_FLAG_SCROLL()`, `https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.LayoutParams#SCROLL_FLAG_EXIT_UNTIL_COLLAPSED()`, `https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.LayoutParams#SCROLL_FLAG_ENTER_ALWAYS()`, `https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.LayoutParams#SCROLL_FLAG_ENTER_ALWAYS_COLLAPSED()`, `https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.LayoutParams#SCROLL_FLAG_SNAP()`, and `https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.LayoutParams#SCROLL_FLAG_SNAP_MARGINS()`. Otherwise, use `https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.LayoutParams#SCROLL_FLAG_NO_SCROLL()` to disable scrolling. |

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.LayoutParams#getScrollFlags()` |   |

### setScrollInterpolator

```
public void setScrollInterpolator(Interpolator interpolator)
```

Set the interpolator to when scrolling the view associated with this `https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.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. |

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.LayoutParams#getScrollInterpolator()` |   |