DaveS
DaveS

Reputation: 105

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.

I can't find any resources which discuss doing this.

Upvotes: 0

Views: 142

Answers (2)

NIKHIL NEDIYODATH
NIKHIL NEDIYODATH

Reputation: 2932

You can also use Collapsing Toolbar

<android.support.design.widget.AppBarLayout
       android:layout_width="match_parent"
       android:layout_height="180dp"
       android:theme="@style/ThemeOverlay.AppCompat.Dark">

       <android.support.design.widget.CollapsingToolbarLayout
           android:id="@+id/collapse_toolbar"
           android:layout_width="match_parent"
           android:layout_height="match_parent"
           app:layout_scrollFlags="scroll|exitUntilCollapsed">

           <android.support.v7.widget.Toolbar
               android: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>

Upvotes: 0

Navdeep Singh
Navdeep Singh

Reputation: 13

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.

Upvotes: 1

Related Questions