2016-04-01 5 views
5

, wenn ich in dieser Reihe TheStyle:was ist der Unterschied zwischen windowActionBar und Android: windowActionBar

<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> 

die ActionBar weggeht.

jedoch, wenn ich es in dieser Reihe:

<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> 

die ActionBar ist immer noch hier.

Was ist der Unterschied?

Antwort

8

android:windowActionBar bezeichnet Eigenschaft für Lollipop und nur oben. Where as windowActionBar bezeichnet für alle Versionen und wird von Support-Bibliothek abgerufen.

11

windowActionBar ist ein Attribut, das in der AppCompat-Bibliothek bereitgestellt wird, wobei android:windowActionBar in Material theme bereitgestellt wird.

Die Aktionsleiste wird entfernt, wenn Sie unter Code, nur weil Sie in dieser Bibliothek selbst AppCompat Bibliothek und aufgerufene das Attribut versehen werden mit:

<item name="windowActionBar">false</item> 

Auf weitere Punkte, dann ist es gleich wie colorPrimary und android:colorPrimary Attribut und alle anderen ähnlichen Attribute.

Zum Beispiel:

Wir Werkstoff Thema wurden mit und unter Bezugnahme android:colorPrimary wie unten Attribut:

<style name="AppTheme" parent="android:Theme.Material.Light"> 
     <item name="android:colorPrimary">@color/primary</item> 
     <item name="android:colorPrimaryDark">@color/primary_dark</item> 
     .... 
     .... 
</style> 

aber wir sind jetzt AppCompat Bibliothek mit nur colorPrimary Attribute, für die Bereitstellung von Kompatibilität Versionen zu senken .

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> 
     <item name="colorPrimary">@color/colorPrimary</item> 
     <item name="colorPrimaryDark">@color/colorPrimaryDark</item> 

     ... 
     ... 

</style>