Skip to content

Commit 76a9b23

Browse files
Material Design Teamafohrman
authored andcommitted
Add SCROLL_FLAG_NO_SCROLL flag for AppBarLayout.LayoutParams
PiperOrigin-RevId: 234683507
1 parent 5685941 commit 76a9b23

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

lib/java/com/google/android/material/appbar/AppBarLayout.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -751,6 +751,7 @@ public static class LayoutParams extends LinearLayout.LayoutParams {
751751
@IntDef(
752752
flag = true,
753753
value = {
754+
SCROLL_FLAG_NO_SCROLL,
754755
SCROLL_FLAG_SCROLL,
755756
SCROLL_FLAG_EXIT_UNTIL_COLLAPSED,
756757
SCROLL_FLAG_ENTER_ALWAYS,
@@ -761,6 +762,12 @@ public static class LayoutParams extends LinearLayout.LayoutParams {
761762
@Retention(RetentionPolicy.SOURCE)
762763
public @interface ScrollFlags {}
763764

765+
/**
766+
* Disable scrolling on the view. This flag should not be combined with any of the other scroll
767+
* flags.
768+
*/
769+
public static final int SCROLL_FLAG_NO_SCROLL = 0x0;
770+
764771
/**
765772
* The view will be scroll in direct relation to scroll events. This flag needs to be set for
766773
* any of the other flags to take effect. If any sibling views before this one do not have this
@@ -866,7 +873,8 @@ public LayoutParams(LayoutParams source) {
866873
* @param flags bitwise int of {@link #SCROLL_FLAG_SCROLL}, {@link
867874
* #SCROLL_FLAG_EXIT_UNTIL_COLLAPSED}, {@link #SCROLL_FLAG_ENTER_ALWAYS}, {@link
868875
* #SCROLL_FLAG_ENTER_ALWAYS_COLLAPSED}, {@link #SCROLL_FLAG_SNAP}, and {@link
869-
* #SCROLL_FLAG_SNAP_MARGINS}.
876+
* #SCROLL_FLAG_SNAP_MARGINS}. Otherwise, use {@link #SCROLL_FLAG_NO_SCROLL} to disable
877+
* scrolling.
870878
* @see #getScrollFlags()
871879
* @attr ref com.google.android.material.R.styleable#AppBarLayout_Layout_layout_scrollFlags
872880
*/

lib/java/com/google/android/material/appbar/res/values/attrs.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@
5454

5555
<declare-styleable name="AppBarLayout_Layout">
5656
<attr name="layout_scrollFlags">
57+
<!-- Disable scrolling on the view. This flag should not be combined with any of the other
58+
scroll flags. -->
59+
<flag name="noScroll" value="0x0"/>
60+
5761
<!-- The view will be scroll in direct relation to scroll events. This flag needs to be
5862
set for any of the other flags to take effect. If any sibling views
5963
before this one do not have this flag, then this value has no effect. -->

0 commit comments

Comments
 (0)