I have an activity where the Actionbar is hidden and when I click a button I want it to be visible, but I don't want the layout activity to scroll down, the bar must overlap it. How can I do such a thing?
To hide the bar i use
actionbar.hide();
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
And to make it visible:
actionbar.show();
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
My layout is just
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<MyPager
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<MyPager>
</RelativeLayout>
Thanks in advance.
You are probably looking for the ActionBar
overlay mode. Enable it for a single Activity
by calling requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
before setContentView()
. Or in a theme by setting android:windowActionBarOverlay
to true
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With