Android AppCompat requires API level 11

后端 未结 1 1206
被撕碎了的回忆
被撕碎了的回忆 2021-01-11 18:58

I have an app that uses the AppCompat support libary for ActionBars. Now I tried to create a new themes.xml file with some style for that purpose.<

相关标签:
1条回答
  • 2021-01-11 20:01

    Add the below in styles.xml under res/values-14

    <style name="Theme.Styled" parent="@style/Theme.AppCompat.Light">
        <!-- Setting values in the android namespace affects API levels 14+ -->
        <item name="android:actionBarStyle">@style/Widget.Styled.ActionBar</item>
    
    </style>
    
    <style name="Widget.Styled.ActionBar" parent="@style/Widget.AppCompat.Light.ActionBar">
        <!-- Setting values in the android namespace affects API levels 14+ -->
        <item name="android:background">#FFFFFF</item>
    
    </style>
    

    You would then need add the following into the values folder: res/values/styles.xml

    <style name="Theme.Styled" parent="@style/Theme.AppCompat.Light">
        <!-- Setting values in the default namespace affects API levels 7-13 -->
        <item name="actionBarStyle">@style/Widget.Styled.ActionBar</item>
    </style>
    
    <style name="Widget.Styled.ActionBar" parent="@style/Widget.AppCompat.Light.ActionBar">
        <!-- Setting values in the default namespace affects API levels 7-13 -->
        <item name="background">#FFFFFF</item>
    </style>
    

    For more details

    http://android-developers.blogspot.in/2013/08/actionbarcompat-and-io-2013-app-source.html

    Notice the change for API level 14+

     <item name="android:actionBarStyle">@style/Widget.Styled.ActionBar</item>
    

    To API level 7-13

     <item name="actionBarStyle">@style/Widget.Styled.ActionBar</item>
    
    0 讨论(0)
提交回复
热议问题