I need to implement splash screen in my honeycomb app. I use this code in activity's onCreate to show splash:
setContentView(R.layout.splash);
getActionBar().hide();
and this code to show main UI after sometime:
setContentView(R.layout.main);
getActionBar().show();
But before onCreate is called and splash appears, there is small amount of time when action bar shown.
How can I make action bar invisible?
I tried to apply theme to activity without action bar:
<item name="android:windowActionBar">false</item>
but in that case getActionBar() always returns null and I found no way to show it again.
If you use one
Activity
included a splash screen, then you can do this if you useSherlockActionBar
After the splash screen you can show it again with ...
It should be the same with native
ActionBar
of Android.I realise that posting links are not the best way to do things, but I highly recommend you read the following documentation from Google themselves. This is the official android doc on how to control your system ui (things like actionbar, nav bar etc). Unfortunately the info is too much to post directly, but after reading this you will understand exactly how to show and hide features no matter what version you are developing for, its so simple!
Incase the link ever changes, it can be found under the official android documentation under training -> getting started -> Best practices for user interface -> managing the system ui
https://developer.android.com/training/system-ui/index.html
In case you have null because you are using the support library, instead of
getActionBar()
you need to callgetSupportActionBar()
.I was also trying to hide Action Bar on Android 2.2, but none of these solution worked. Everything ends with a crash. I checked the DDMS LOg, It was telling me to use 'Theme.AppCompat'.At last I Solved the problem by changing the
android:theme="@android:style/Theme.Holo.Light.NoActionBar"
Lineinto
android:theme="@style/Theme.AppCompat.NoActionBar"
and it worked, but the the Interface was dark.then i tried
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
and finally got what i wanted.After that when I Searched about 'AppCompat' on Developer Site I got This.
So I think the Solution for Android 2.2 is
And Sorry for my bad English Like Always.
The best way I find after reading all the available options is set main theme without ActionBar and then set up MyTheme in code in parent of all Activity.
Manifest:
BaseActivity:
This way helps me to avoid ActionBar when application start!
If you are using ActionBarSherlock, then use Theme.Sherlock.NoActionBar Theme in your Activity