I notice the action bar (Theme.Holo) looks cool only in android 3.0 or heigher, but it doesn't like nice on for example Android 2.3.
is there away to show the action bar ( Theme.Holo) based on Android version?
If you want to hide Action Bar from the entire application (from all Activities and fragments), then you can use this method. Just go to res -> values -> styles. xml and change the base application to “Theme.
android:windowActionBar denotes property for lollipop and above only. Where as windowActionBar denotes for all versions and is retrieved from support library. Follow this answer to receive notifications.
Android ActionBar is a menu bar that runs across the top of the activity screen in android. Android ActionBar can contain menu items which become visible when the user clicks the “menu” button.
The action bar requires API 11 minimum. If you want to remove it programatically though you can use hide() in the code for that activity.
ActionBar actionBar = getActionBar();
actionBar.hide();
Not really sure what it would show for anything below 3.0, but it seems like the best place to start.
Edit:
You can check the SDK version at run time with the Build constants
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { //checks if its lower than Honeycomb
ActionBar actionBar = getActionBar();
actionBar.hide();
}
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