My android app has tab navigation using an action bar. It works well, but it bothers me that during the first boot of the app, a small default action bar briefly shows up before being replaced by the real, tab-navigation action bar. My onCreate starts like this:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
setContentView(R.layout.activity_main);
//Set up the actionbar
final ActionBar actionBar = getActionBar();
.
.
.
What do I have to do so that the real actionbar will be initialized without a small default one briefly showing before it does on startup?
Thanks
Show back button using actionBar. setDisplayHomeAsUpEnabled(true) this will enable the back button. Custom the back event at onOptionsItemSelected. This will enable the back function to the button on the press.
Hide during startup
getSupportActionBar().hide();
After you can show it again with ...
getSupportActionBar().show();
It should be the same with native ActionBar of Android.
you should use this line in manifest and don't use getActionBar()
<item name="android:windowActionBar">false</item>
and once it's finished in the main Activity use below or nothing
<item name="android:windowActionBar">true</item>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With