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.
The solutions already posted came with the sideffect, that the first .show() call did not animate the ActionBar for me. I got another nice solution, which fixed that:
Create a transparent drawable - something like that:
Set the actual actionbar background to a invisible custom view which you set on the actionbar:
Set the transparent background for the actionbar in onCreate:
Imortant: Don't hide the actionbar immediately in onCreate, but with a little delay later - e.g. when the layout is finished with creation:
Before your first .show() call set the custom view visible:
Android studio provide in build template for full screen, if you use Android studio you can follow below step to implement full screen activity.
Done. Android studio did your job, now you can check code for full screen.
The best way to do this is two make the first activity as blank activity and the content you want to put and then after some time fire another activity. By following this way you can make the first activity as your splash screen without action bar or anything. Heres my first activity
After that you can put any of your activity as first activity If you want no action bar in any screen then just add this in your styles
Create two styles:
Set AppThemeNoBar as application theme and AppThemeBar to the activity where you want to show the ActionBar. Using two styles you wont see the Action bar while views are loading.
Check this link Android: hide action bar while view load
Hi I have a simple solution by using 2 themes
Splash screen theme (add it to the manifest):
<style name="SplashTheme" parent="@android:style/Theme.Holo.NoActionBar"> <item name="android:windowBackground">@color/red</item> </style>
normal theme (add it in your activity by setTheme(R.style.Theme)):
<style name="Theme" parent="@style/Theme.Holo"> <item name="android:windowBackground">@color/blue</item> </style>
To support SDK 10:
2015, using support v7 library with AppCompat theme, set this theme for your Activity.