@@ -266,6 +266,34 @@ In the layout:
266266</androidx .coordinatorlayout.widget.CoordinatorLayout>
267267```
268268
269+ Optionally, you can change the style in which the app bar disappears and
270+ appears when scrolling by setting a scroll effect. By default, a scroll effect
271+ of ` none ` is set which translates the app bar in-step with the scrolling
272+ content. The following option shows setting the ` compress ` scroll effect
273+ which clips the top app bar until it meets the top of the screen:
274+
275+ In the layout:
276+
277+ ``` xml
278+ <androidx .coordinatorlayout.widget.CoordinatorLayout
279+ ...>
280+
281+ <com .google.android.material.appbar.AppBarLayout
282+ ...>
283+
284+ <com .google.android.material.appbar.MaterialToolbar
285+ ...
286+ app : layout_scrollFlags =" scroll|enterAlways|snap"
287+ app : layout_scrollEffect =" compress"
288+ />
289+
290+ </com .google.android.material.appbar.AppBarLayout>
291+
292+ ...
293+
294+ </androidx .coordinatorlayout.widget.CoordinatorLayout>
295+ ```
296+
269297### Status bar and edge-to-edge
270298
271299![ Small top app bar with edge-to-edge status bar] ( assets/topappbar/topappbar_small.png )
@@ -375,6 +403,7 @@ Element | Attribute
375403** ` AppBarLayout ` lift on scroll** | ` app:liftOnScroll ` | ` setLiftOnScroll ` <br >` isLiftOnScroll ` | ` true `
376404** ` AppBarLayout ` lift on scroll color** | ` app:liftOnScrollColor ` | N/A | ` @null ` (defaults to elevation overlay color)
377405** ` AppBarLayout ` lift on scroll target view** | ` app:liftOnScrollTargetViewId ` | ` setLiftOnScrollTargetViewId ` <br >` getLiftOnScrollTargetViewId ` | ` @null `
406+ ** ` AppBarLayout ` scroll effect** | ` app:layout_scrollEffect ` | ` setScrollEffect ` <br >` getScrollEffect ` | ` none `
378407
379408#### ` AppBarLayout ` styles
380409
0 commit comments