android - Common styles for v10 and v11+? -


i'm using v7 support library in order have actionbar on api level 10+ (that's android 2.3.3+). now, want customize bit, added application theme. excerpt of values/styles.xml:

<style name="apptheme" parent="theme.appcompat.light">     <item name="actionbarstyle">@style/actionbarstyle</item> </style>  <style name="actionbarstyle" parent="@style/widget.appcompat.actionbar">     <item name="background">@drawable/bg_actionbar</item> </style> 

this works fine on android 2.3.3, compat stuff used. however, on android 4.3 on n4 (or emulator), styles not applied. if change styles.xml file to:

<style name="apptheme" parent="theme.appcompat.light">     <item name="android:actionbarstyle">@style/actionbarstyle</item> </style>  <style name="actionbarstyle" parent="@style/widget.appcompat.actionbar">     <item name="android:background">@drawable/bg_actionbar</item> </style> 

(notice added android: prefix) works on 4.3, doesn't on 2.3 (styles not applied).

is there way can around without specifying each <item> twice, once prefix , once without?

there perfect example on google docs site:

http://developer.android.com/guide/topics/ui/actionbar.html#styleexample

<?xml version="1.0" encoding="utf-8"?> <resources>     <!-- theme applied application or activity -->     <style name="customactionbartheme"            parent="@style/theme.appcompat.light">         <item name="android:actionbarstyle">@style/myactionbar</item>         <item name="android:actionbartabtextstyle">@style/tabtextstyle</item>         <item name="android:actionmenutextcolor">@color/actionbar_text</item>          <!-- support library compatibility -->         <item name="actionbarstyle">@style/myactionbar</item>         <item name="actionbartabtextstyle">@style/tabtextstyle</item>         <item name="actionmenutextcolor">@color/actionbar_text</item>     </style>      <!-- general styles action bar -->     <style name="myactionbar"            parent="@style/widget.appcompat.actionbar">         <item name="android:titletextstyle">@style/titletextstyle</item>         <item name="android:background">@drawable/actionbar_background</item>         <item name="android:backgroundstacked">@drawable/actionbar_background</item>         <item name="android:backgroundsplit">@drawable/actionbar_background</item>          <!-- support library compatibility -->         <item name="titletextstyle">@style/titletextstyle</item>         <item name="background">@drawable/actionbar_background</item>         <item name="backgroundstacked">@drawable/actionbar_background</item>         <item name="backgroundsplit">@drawable/actionbar_background</item>     </style>      <!-- action bar title text -->     <style name="titletextstyle"            parent="@style/textappearance.appcompat.widget.actionbar.title">         <item name="android:textcolor">@color/actionbar_text</item>     </style>      <!-- action bar tab text -->     <style name="tabtextstyle"            parent="@style/widget.appcompat.actionbar.tabtext">         <item name="android:textcolor">@color/actionbar_text</item>     </style> </resources> 

Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -