我在设置分割线的drawable时遇到了问题。我的style.xml文件看起来像这样:
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="HCLTheme" parent="android:Theme.Holo.Light">
<item name="android:actionBarStyle">@style/HCLActionBarStyle</item>
<item name="actionBarStyle">@style/HCLActionBarStyle</item>
<item name="android:actionBarTabBarStyle">@style/HCLActionBarTabBarStyle</item>
<item name="android:actionBarTabStyle">@style/HCLActionBarTabStyle</item>
</style>
<style name="HCLActionBarStyle" parent="android:style/Widget.Holo.ActionBar">
<item name="android:background">@drawable/hcl_actionbar_drawable</item>
<item name="background">@drawable/hcl_actionbar_drawable</item>
<item name="android:titleTextStyle">@style/HCLActionBarTitle</item>
</style>
<style name="HCLActionBarTabBarStyle" parent="@android:style/Widget.Holo.ActionBar.TabBar">
<item name="android:showDividers">middle</item>
<item name="android:divider">@drawable/divider</item>
<item name="android:dividerPadding">0dp</item>
</style>
<style name="HCLActionBarTabStyle" parent="@android:style/Widget.Holo.ActionBar.TabView">
<item name="android:background">@drawable/action_bar_tab_style</item>
</style>
<style name="HCLActionBarTitle" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Title">
<item name="android:textColor">@android:color/white</item>
</style>
</resources>
在HCLActionBarTabBarStyle中,我将@drawable/divider设置为选项卡分隔符。这个drawable是一个9patch图像,是一条竖直的黑线。
在xml中设置分隔符之前,我得到了普通的白色分隔符,如下所示:
![https://dl.dropbox.com/u/93667096/a.png](https://istack.dev59.com/tI9c7.webp)
![https://dl.dropbox.com/u/93667096/b.png](https://istack.dev59.com/LXhW7.webp)