2

我已经用 theme.sherlock 实现了 Action bar Sherlock。操作栏有导航选项卡。我已经使用样式来自定义操作栏。样式xml如下所示

 <resources>
 <style name="MyTheme" parent="Theme.Sherlock">
<item name= "actionBarStyle">@style/ActionStyle</item>
<item name="actionBarTabTextStyle">@style/MyTabTextStyle</item>
</style>
<style name= "ActionStyle" parent="Widget.Sherlock.ActionBar">
   <item name="android:background">@drawable/actionstyle</item>
   <item name="background">@drawable/actionstyle</item>
  </style>
<style name="MyTabTextStyle" parent="Widget.Sherlock.ActionBar.TabText" >
<item name="android:textColor">#0EBFE9</item>
<item name ="android:textStyle">bold</item>
<item name= "android:textSize">14dp</item>
</style>
 </resources>

可绘制的动作风格

  <?xml version="1.0" encoding="utf-8"?>
 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Bottom Line -->
<item>
    <shape android:shape="rectangle">
        <solid android:color="@android:color/darker_gray"/>
    </shape>
</item>

<!-- Color of your action bar -->
<item android:bottom="2dip">
    <shape android:shape="rectangle">
        <solid android:color="@android:color/darker_gray" />
    </shape>
</item>
</layer-list>

我需要删除操作栏和导航选项卡之间的分隔线 在导航选项卡下方显示蓝色分隔线

4

1 回答 1

1

您所要做的就是设置backgroundxml 的属性。您可以将“颜色”设置为透明以将其删除。

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <!-- Bottom Line -->
    <item>
        <shape android:shape="rectangle">
            <solid android:color="@android:color/transparent" />
        </shape>
    </item>

    <!-- Color of your action bar -->
    <item android:bottom="2dip">
        <shape android:shape="rectangle">
            <solid android:color="@color/action_bar_color" />
        </shape>
    </item>
</layer-list>

然后将其应用到您的主题中:

<style name="Widget.MyTheme.ActionBar" parent="Widget.Sherlock.ActionBar">
    <item name="android:background">@drawable/action_bar_background</item>
    <item name="background">@drawable/action_bar_background</item>
</style>
于 2013-02-12T11:23:16.037 回答