Skip to content Skip to sidebar Skip to footer

Hide Action Bar, But Show When Pulled Down

I have an action bar set up and it works great. I'd like to have it so that it is hidden until the user does something like pull down from the top of the screen, and then show it.

Solution 1:

You can toggle its visiblity using OnClickListener on layout or if you have some layout that is scrolled by the user then you can experiment with OnScrollChangeListener.

Solution 2:

You can also use Collapsing Toolbar

<android.support.design.widget.AppBarLayoutandroid:layout_width="match_parent"android:layout_height="180dp"android:theme="@style/ThemeOverlay.AppCompat.Dark"><android.support.design.widget.CollapsingToolbarLayoutandroid:id="@+id/collapse_toolbar"android:layout_width="match_parent"android:layout_height="match_parent"app:layout_scrollFlags="scroll|exitUntilCollapsed"><android.support.v7.widget.Toolbarandroid:id="@+id/toolbar"android:layout_width="match_parent"android:layout_height="?attr/actionBarSize"app:layout_collapseMode="pin" /></android.support.design.widget.CollapsingToolbarLayout></android.support.design.widget.AppBarLayout>

Post a Comment for "Hide Action Bar, But Show When Pulled Down"