when I set thestyle in this:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
the actionbar will go away.
however,when I set it in this:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:windowActionBar">false</item>
<item name=“android:windowNoTitle">true</item>
</style>
the actionbar is still here.
what's the difference ?
What is the difference between the toolbar and the action bar? The most obvious difference between the two is the updated visual design of the toolbar. The toolbar no longer includes an icon on the left side and decreases some of the spacing between the action items on the right side.
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. AppCompat.
setDisplayHomeAsUpEnabled(boolean showHomeAsUp) Set whether home should be displayed as an "up" affordance.
The ActionBar, now known as the App Bar, is a consistent navigation element that is standard throughout modern Android applications. The ActionBar can consist of: An application icon. An "upward" navigation to logical parent. An application or activity-specific title.
windowActionBar
is an attribute provided in AppCompat library, where as android:windowActionBar
is provided in Material theme.
The action bar is going away when you set below code, just because you are using AppCompat library and referring the attribute provided in this library itself:
<item name="windowActionBar">false</item>
On another points, it's same as colorPrimary
and android:colorPrimary
attribute and all other similar attributes.
For example:
We were using Material theme and referring android:colorPrimary
attribute as below:
<style name="AppTheme" parent="android:Theme.Material.Light">
<item name="android:colorPrimary">@color/primary</item>
<item name="android:colorPrimaryDark">@color/primary_dark</item>
....
....
</style>
but we are now using AppCompat library with only colorPrimary
attribute, for providing compatibility to lower versions.
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
...
...
</style>
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