我已经使用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>
我需要 删除操作栏和导航选项卡之间的分隔符 在导航标签下显示蓝色分隔线
答案 0 :(得分:1)
您所要做的就是设置xml的background
属性。您可以设置“颜色”透明以将其删除。
<?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>