Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what's the difference between windowActionBar and android:windowActionBar

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 ?

like image 905
zzh0838 Avatar asked Apr 01 '16 11:04

zzh0838


People also ask

What is difference between action bar and toolbar in android?

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.

How can use no action bar in android?

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.

What is setDisplayHomeAsUpEnabled?

setDisplayHomeAsUpEnabled(boolean showHomeAsUp) Set whether home should be displayed as an "up" affordance.

What is support action bar?

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.


1 Answers

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>
like image 115
Paresh Mayani Avatar answered Oct 10 '22 20:10

Paresh Mayani