Android (3.0) Action Bar does not want to go

I am working with XOOM and trying to hide the action bar. Therefore, I follow the instructions by doing the following in the manifest file:

uses-sdk android:minSdkVersion="11" android:targetSdkVersion="11"

also sets the topic of activity.

android:theme="@android:style/Theme.Holo.NoActionBar"

Unfortunately, I still see the action bar. so I remove part of the hunger action from my manifest and add the following code

ActionBar actionBar = getActionBar(); actionBar.hide();

getting an exception from the null pointer from the hide () method. so I understand that getActionBar () returns null. Now I wonder what I am missing?

+6
source share
5 answers

Theme.Holo.NoActionBar is not publicly available within the framework. Instead, you can declare your own style as follows:

 <style name="MyTheme" parent="@android:style/Theme.Holo.Light"> <item name="android:windowActionBar">false</item> <item name="android:windowNoTitle">true</item> </style> 
+19
source

I came to the exact same conclusion. If you cannot do an ActionBar show on screen, most likely this is:

  • the window has no name; An ActionBar is essentially an illustrious title bar, therefore title = no ActionBar, although this is not mentioned anywhere in the docs

  • You tried to call the getActionBar () method, previously setting the presentation of the content in the activity. In this case, this method returns null. Again, not mentioned anywhere in the docs, and if you are trying to build / modify an ActionBar as part of a custom view constructor, you're out of luck.

Read more about my research on ActionBar at Honeycomb on my blog here.

+7
source

you can hide the action bar (which will be displayed at the top of the screen). If your activity is a tab activity, use the following line after the setcontentview line

 getParent().getActionBar().hide(); 

If this is normal activity, use

 getActionBar().hide(); 

And the installation in the manifest also works for me, but only for a specific activity that you can install if not on the application.

 android:theme="@android:style/Theme.Holo.NoActionBar" 
+3
source

it helped me .. edited the values ​​of /styles.xml like this

 <resources> <style name="AppTheme" parent="android:Theme.Holo.Light.NoActionBar" /> </resources> 
+2
source

Honeycomb’s action bar cannot be hidden because there are no physical buttons to return from the application, so you can lure users into the application if the action bar is hidden. The best thing you can do is put the panel in glow mode, where you get small dots instead of the usual panel icons.

See this link: Is there a way to hide the system bar in Android 3.0? This is an internal device, and I control the navigation

-9
source

Source: https://habr.com/ru/post/887467/


All Articles