Skip to content

[AppBarLayout] Inconsistent default scrollFlags between XML and code #5082

@huajiqaq

Description

@huajiqaq

Description:
AppBarLayout.LayoutParams defaults scrollFlags to SCROLL_FLAG_SCROLL (1) at field declaration, but XML inflation defaults to 0 (no scroll) when attribute is absent.

Expected behavior:
Both should default to 0 for consistency.

Source code:

// Field declaration - defaults to 1
int scrollFlags = SCROLL_FLAG_SCROLL;
// XML inflation - defaults to 0 when attribute missing
scrollFlags = a.getInt(R.styleable.AppBarLayout_Layout_layout_scrollFlags, 0);

Workaround:
Explicitly set params.scrollFlags = 0 when creating programmatically.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions