5

I set "android:uiOptions="splitActionBarWhenNarrow" in AndroidManifest.xml. Therefore, if there is no enough room for the device, the action bar will be split into two parts.

Sometime, I want to hide the action bar by calling getActionBar().hide(). But it will leave an ugly white space in the bottom. How can I get rid of it?

I tried to call getActivity().getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY), but it would block my webview content.

Before

After

1
  • So you want to hide just the bottom bar? Aug 13, 2014 at 10:45

3 Answers 3

3

Just a simple work, simply use OverLay. use this in your style

<style name="AppTheme" parent="@style/Theme.AppCompat">
    <item name="android:windowNoTitle">false</item>
    <item name="android:windowFullscreen">true</item>
    <item name="android:windowActionBarOverlay">true</item>
</style>

or if you want to do it by programmatically, just past it before your setContentView() function

requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);

and give some transparency, so it won't hide the web content. just read the documentation for the style

http://developer.android.com/training/basics/actionbar/overlaying.html

2
  • I think he wants to hide just the bottom bar. Your solution will hide both top and bottom, right? Aug 13, 2014 at 10:47
  • Yes,but overlay with transparency is the best choice. Otherwise he has to add custom bottom bar. lil time consuming too.
    – Kirk
    Aug 13, 2014 at 10:59
1

Try to remove android:uiOptions from <application> or <activity> elements from the AndroidManifest. Also, remove the android.support.UI_OPTIONS for activity that need in the AndroidManifest.

-1

the split bar can only be hidden with api 11 for the other i tried on my tablet right now and it continue to be here on the screen, my tablet have android 4 api >10 then split bar must be taken into count when designing a layout example: for games touch screen like tablets or phone without harwdware key ,the thouch event x,y must be trasformed to y=y+height of the split bar, becouse the size of the window is fullscreen - splitbar and that make a lot of difference if you have graphical interface drawed with canvas ,that mean you must check if the touch is iniside a rectagle of a screen button. and use dp pixel and not pure pixel ,all drawing maust use dp converted pixel cordiantes for make sure that have same coridanate system on the screen and on the canvas px = dp *(dpi * default dpi) deafult dpi is 160pdi screen medium pixel resolution

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.