AppCompat,试图在版本7.21中设置tabbar样式

时间:2015-01-16 22:29:13

标签: android android-theme android-appcompat

我正在尝试使用以下代码设置TabBar的样式:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="MyTheme" parent="MyTheme.Base"/>

    <style name="MyTheme.Base" parent="Theme.AppCompat">
        <item name="colorPrimary">@color/palette_1</item>
        <item name="colorPrimaryDark">@color/palette_5</item>
        <item name="android:windowNoTitle">true</item>
        <item name="windowActionBar">true</item>

        <item name="android:windowBackground">@color/palette_1</item>

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

        <item name="actionBarTabStyle">@style/MyTheme.ActionBarTabBar</item>
        <item name="android:actionBarTabStyle">@style/MyTheme.ActionBarTabBar</item>
    </style>

    <style name="MyTheme.ActionBar" parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
        <item name="background">@color/palette_5</item>
        <item name="backgroundStacked">@color/palette_5</item>
        <item name="backgroundSplit">@color/palette_5</item>
    </style>

    <style name="MyTheme.ActionBarTabBar" parent="@style/Widget.AppCompat.ActionBar.TabView">
        <item name="android:background">@color/palette_5</item>
    </style>

    <style name="MyTheme.NoTitleBar" parent="MyTheme">
        <item name="android:windowNoTitle">true</item>
        <item name="windowActionBar">false</item>
    </style>

</resources>

Whewre palette_1为绿色,palette_5为蓝色。 actionBar是蓝色的,但tabbar保持我在android:windowBackground中定义的颜色,它是绿色的。

这是我在搜索了大量主题后想出的代码。但它似乎在某处相互冲突。

0 个答案:

没有答案