App Bar Layout
(SESL Variant) AppBarLayout is a vertical LinearLayout which implements many of the features of Material Design's app bar concept, specifically scrolling gestures and Samsung One UI (SESL) features.
In addition to standard Material app bar features, this SESL variant provides:
Core SESL Features
- One UI Responsive Proportions: Dynamic height calculation for expanded app bar states relative to screen height, configurable via XML attributes (
app:seslHeightProportion,app:seslUseCustomHeight) or programmatically using seslSetCustomHeightProportion and seslSetCustomHeight. - Immersive Offset Observers: Custom offset listeners (SeslOnImmOffsetChangedListener) to monitor vertical layout changes during immersive scroll.
SESL 9 Added Features
- Floating Toolbar Mode: Support for floating toolbar layouts configured via setUseFloatingToolbar. Note: Floating toolbar feature must be used with FloatingToolbarLayout.
- App Bar State Monitoring: State flags tracking app bar layout states (SESL_STATE_IDLE, SESL_STATE_EXPANDED, SESL_STATE_COLLAPSED, SESL_STATE_HIDE) and listener callbacks via AppBarStateChangedListener and seslAddAppBarStateChangedListener.
- Hide State &Transition Controls: Programmatic and gesture-driven transition to a hidden state using seslSetHide and control over hide eligibility via seslSetAllowStateToHide.
- Offset Animation Observers: Offset animation listeners via seslAddAnimateOffsetListener.
- Forced Expansion &Scroll Hold Controls: Programmatically force expanded state via seslStartForceSetExpanded / seslStopForceExpanded, control nested scroll start via seslAllowStartNestedScroll, and custom scroll flags in LayoutParams (SESL_SCROLL_FLAG_NO_SCROLL_HOLD, SESL_SCROLL_FLAG_NO_SNAP).
- Lift-on-Scroll Progress Monitoring: Callbacks for tracking lift-on-scroll elevation and color transition progress via LiftOnScrollProgressListener.
Children should provide their desired scrolling behavior through setScrollFlags and the associated layout xml attribute:
app:layout_scrollFlags.
This view depends heavily on being used as a direct child within a CoordinatorLayout. If you use AppBarLayout within a different ViewGroup, most of its functionality will not work.
AppBarLayout also requires a separate scrolling sibling in order to know when to scroll. The binding is done through the ScrollingViewBehavior behavior class, meaning that you should set your scrolling view's behavior to be an instance of ScrollingViewBehavior. A string resource containing the full class name is available.
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<!-- Your scrolling content -->
</androidx.core.widget.NestedScrollView>
<com.google.android.material.appbar.AppBarLayout
android:layout_height="wrap_content"
android:layout_width="match_parent">
<androidx.appcompat.widget.Toolbar
...
app:layout_scrollFlags="scroll|enterAlways"/>
<com.google.android.material.tabs.TabLayout
...
app:layout_scrollFlags="scroll|enterAlways"/>
</com.google.android.material.appbar.AppBarLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
For more information, see the component developer guidance and design guidelines.
Types
app:layout_scrollEffectcompress, at each step in the AppBarLayout's offset animation.