2

我使用 Android 操作栏和选项卡,我想更改我的选项卡背景颜色。我尝试以我的风格将其应用于以下内容:

Widget.AppCompat.ActionBar
Widget.AppCompat.ActionBar.TabBar
Widget.AppCompat.ActionBar.TabView
Widget.AppCompat.ActionBar.Solid

它适用于所有情况,但在井中移除了分隔线(每个选项卡之间的小条)。我怎样才能避免这种情况?

4

1 回答 1

1

您可以定义一种样式并将其应用于您的应用程序或活动:

文件styles.xml

<style name="MyHoloLightTheme" parent="@style/Theme.AppCompat.Light">
    <item name="actionBarStyle">@style/ActionBarStyle</item>
    ....
<style name="ActionBarStyle" parent="...">
    <item name="background">@color/actionBarBackgroundColor</item>
    ...

文件color.xml

<color name="actionBarBackgroundColor">#00ff00</color>

适用于应用程序AndroidManifest.xml

<application
    ...
    android:theme="@style/MyHoloLightTheme"
    ...
于 2015-04-28T08:47:14.297 回答