AppBarLayout

(SESL Variant) AppBarLayout is a vertical LinearLayout which implements many of the features of material designs app bar concept, namely scrolling gestures.

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.

Constructors

Link copied to clipboard
constructor(@NonNull context: Context)
constructor(@NonNull context: Context, @Nullable attrs: AttributeSet)
constructor(@NonNull context: Context, @Nullable attrs: AttributeSet, defStyleAttr: Int)

Types

Link copied to clipboard
Interface definition for a callback to be invoked when an AppBarLayout's vertical offset changes.
Link copied to clipboard
open class Behavior : AppBarLayout.BaseBehavior<T>
The default Behavior for AppBarLayout.
Link copied to clipboard
abstract class ChildScrollEffect
An effect class that should be implemented and used by AppBarLayout children to be given effects when the AppBarLayout's offset changes.
Link copied to clipboard
A class which handles updating an AppBarLayout child, if marked with the app:layout_scrollEffectcompress, at each step in the AppBarLayout's offset animation.
Link copied to clipboard
Link copied to clipboard
Definition for a callback to be invoked when the lift on scroll elevation and background color change.
Link copied to clipboard
Interface definition for a callback to be invoked when an AppBarLayout's vertical offset changes.
Link copied to clipboard
open class ScrollingViewBehavior : HeaderScrollingViewBehavior
Behavior which should be used by Views which can scroll vertically and support nested scrolling to automatically scroll any AppBarLayout siblings.
Link copied to clipboard
open class SeslAppbarState

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
Add a LiftOnScrollListener that will be called when the lift on scroll elevation and background color of this AppBarLayout change.
Link copied to clipboard
Add a listener that will be called when the offset of this AppBarLayout changes.
Link copied to clipboard
Remove all previously added LiftOnScrollListeners.
Link copied to clipboard
Link copied to clipboard
open fun draw(@NonNull canvas: Canvas)
Link copied to clipboard
Link copied to clipboard
open fun isLifted(): Boolean
Returns whether the AppBarLayout is in a lifted state or not.
Link copied to clipboard
Returns whether the AppBarLayout lifts on scroll or not.
Link copied to clipboard
Remove a previously added LiftOnScrollListener.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun seslSetBottomView(bottomView: View)
open fun seslSetBottomView(view: View, bottomView: View)
Link copied to clipboard
open fun seslSetCollapsedHeight(height: Float)
Link copied to clipboard
open fun seslSetCustomHeight(height: Int)
Link copied to clipboard
open fun seslSetCustomHeightProportion(enabled: Boolean, @FloatRange(from = 0, to = 1) proportion: Float)
Link copied to clipboard
open fun seslSetExpanded(expanded: Boolean)
Link copied to clipboard
Link copied to clipboard
open fun seslSetIsMouse(isMouse: Boolean)
Link copied to clipboard
Link copied to clipboard
open fun seslSetSuggestion(hasSuggestion: Boolean)
Link copied to clipboard
open fun seslSetTCScrollRange(range: Int)
Link copied to clipboard
Link copied to clipboard
open fun setExpanded(expanded: Boolean)
Sets whether this AppBarLayout is expanded or not, animating if it has already been laid out.
open fun setExpanded(expanded: Boolean, animate: Boolean)
Sets whether this AppBarLayout is expanded or not.
Link copied to clipboard
open fun setLiftable(liftable: Boolean): Boolean
Sets whether the AppBarLayout is liftable or not.
Link copied to clipboard
Sets whether the AppBarLayout lifted state corresponding to setLiftable and setLifted will be overridden manually.
Link copied to clipboard
open fun setLifted(lifted: Boolean): Boolean
Sets whether the AppBarLayout is in a lifted state or not.
Link copied to clipboard
open fun setLiftOnScroll(liftOnScroll: Boolean)
Sets whether the AppBarLayout lifts on scroll or not.
Link copied to clipboard
open fun setLiftOnScrollTargetView(@Nullable liftOnScrollTargetView: View)
Sets the view that the AppBarLayout should use to determine whether it should be lifted.
Link copied to clipboard
open fun setOrientation(orientation: Int)
Link copied to clipboard
Set the color to use for the status bar foreground.
Link copied to clipboard
Set the drawable to use for the status bar foreground from resources.
Link copied to clipboard
open fun setTargetElevation(elevation: Float)
Link copied to clipboard
open fun setVisibility(visibility: Int)