# AppBarLayout.CompressChildScrollEffect

[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.CompressChildScrollEffect extends AppBarLayout.ChildScrollEffect
```

<br />

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) |||
| ↳ | [com.google.android.material.appbar.AppBarLayout.ChildScrollEffect](https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.ChildScrollEffect) ||
|   | ↳ | [com.google.android.material.appbar.AppBarLayout.CompressChildScrollEffect](https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.CompressChildScrollEffect) |

*** ** * ** ***

A class which handles updating an AppBarLayout child, if marked with the `
app:layout_scrollEffect``compress`, at each step in the `AppBarLayout`'s offset animation.

Only a single `AppBarLayout` child should be given a compress effect.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.CompressChildScrollEffect#CompressChildScrollEffect()()` |

| ### Public methods |
|---|---|
| `void` | `https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.CompressChildScrollEffect#onOffsetChanged(com.google.android.material.appbar.AppBarLayout,View,float)(https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout appBarLayout, View child, float offset)` Called each time the AppBarLayout's offset changes. |

## Public constructors

### CompressChildScrollEffect

```
public CompressChildScrollEffect()
```

## Public methods

### onOffsetChanged

```
public void onOffsetChanged(AppBarLayout appBarLayout, View child, float offset)
```

Called each time the AppBarLayout's offset changes. Update the `child` with any desired effects.

| Parameters |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout appBarLayout` | The parent AppBarLayout |
| `View child` | The View to be given any desired effect |