Sometimes we hide the Actionbar in the code, and when we open the app, it's still a short flash of actionbar, and the user experience is bad.
The simplest way to do this is to set the theme in Androidmanifest.xml to not show the title or action, which is: <style name= "Notitle" parent= "Android:Theme.Holo.Light" ><item name= "Android:windowactionbar" >true</item></style> or <style name= "Notitle" parent= "Android:Theme.Holo.Light" ><item name= "Android:windownotitle" >true</item></style> but sometimes, if you want to show Actionbar, you can not set in androidmanifest.xml so, I tried, do the above settings, can not show actionbar (this I try the result is so, there can be displayed please give me a reply), at this time, how to solve this problem, in StackOverflow see there is a solution, posted here: Setting Android:windowactionbar=false truly disables the ActionBar and then, as you say, Getactionbar () returns NULL. this was solved by: Public void OnCreate (Bundle savedinstancestate) {super.oncreate (savedinstancestate);GetWindow (). Requestfeature (Window.feature_action_bar);Getactionbar (). Hide (); Setcontentview (R.layout.splash);//Be sure-the-after Requestfeature But now there is another problem. After putting Windowactionbar=false in the theme, the Activity draws their normal Window Title instead of an ActionBar.If We try to avoid this by using some of the *. Notitlebar stock themes or we try to put true in our own theme, it won ' t work.The reason is and the ActionBar depends on the Window Title to display itself-that are the ActionBar is a transforme D Window Title.So the trick which can help us out are to add one more thing to our Activity theme xml: <item name= "Android:windowactionbar" >false</item><item name= "android:windowtitlesize" >0dp</item> This would make the Window Title with zero height, thus practically invisible. in your case, after you is done with displaying the splash-can simply call Setcontentview (r.layout.main);Getactionbar (). Show ()And you were done . The Activity would start with no ActionBar flickering, nor Window Title showing
Android Development hides the Actionbar still short flash solution