找不到@ style / Widget.Holo.ActionBar.TabView的资源

我试图自定义我的ActionBar的选项卡指标下面的这个参考,但是我得到的错误:

Error retrieving parent for item: No resource found that matches the given name '@style/Widget.Holo.ActionBar.TabView'. 

最小SDK设置为14,目标SDK = 18。任何想法?

编辑:

我已经有了以下样式的工作:

  <style name="sMain" parent="@android:style/Theme.Holo"> <item name="android:icon">@android:color/transparent</item> <item name="android:actionBarStyle">@style/MyActionBar</item> <item name="android:actionBarDivider">@null</item> </style> <style name="MyActionBar" parent="android:Widget.Holo.ActionBar"> <item name="android:actionBarDivider">@null</item> </style> 

Solutions Collecting From Web of "找不到@ style / Widget.Holo.ActionBar.TabView的资源"

你应该参考

 @android:style/Widget.Holo.ActionBar.TabView 

在文档中的错字 – 他们离开了android:

这是你需要做的:

为您的应用程序创build一个样式:在这里,我自定义选项卡栏,它的文本(我使用的基本兼容性主题,但你可以使用HOLO或任何你喜欢的):

  <style name="AppTheme" parent="Theme.AppCompat.Light"> <item name="android:actionBarTabTextStyle">@style/TabTextStyle</item> <item name="android:actionBarTabStyle">@style/TabBarStyle</item> <!-- Support library compatibility (ActionBarCompat) --> <item name="actionBarTabTextStyle">@style/TabTextStyle</item> <item name="actionBarTabStyle">@style/TabBarStyle</item> </style> 

创build这些样式:

 <style name="TabTextStyle" parent="@style/Widget.AppCompat.ActionBar.TabText"> <item name="android:textColor">@color/ab_tab_txt</item> </style> <style name="TabBarStyle" parent="@style/Widget.AppCompat.ActionBar.TabView"> <item name="android:background">@drawable/tab_indicator</item> </style> 

对于颜色和绘图,您可以创build一个select器,使选项卡可以根据点击和select进行更改:

文件:res / color / ab_tab_txt(我使用res / values中的颜色文件来设置我的常量,但是可以像这样放置颜色:#FFF)

  <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_selected="true" android:color="@color/ab_tab_txt_selected"/> <item android:color="@color/ab_tab_txt_unselected"/> </selector> 

文件res / drawable / tab_indicator

 <selector xmlns:android="http://schemas.android.com/apk/res/android"> <!-- Non focused states --> <item android:state_focused="false" android:state_selected="false" android:state_pressed="false" android:drawable="@android:color/transparent" /> <item android:state_focused="false" android:state_selected="true" android:state_pressed="false" android:drawable="@drawable/tab_selected_example" /> <!-- Focused states --> <item android:state_focused="true" android:state_selected="false" android:state_pressed="false" android:drawable="@drawable/tab_unselected_focused_example" /> <item android:state_focused="true" android:state_selected="true" android:state_pressed="false" android:drawable="@drawable/tab_selected_focused_example" /> <!-- Pressed --> <!-- Non focused states --> <item android:state_focused="false" android:state_selected="false" android:state_pressed="true" android:drawable="@drawable/tab_unselected_pressed_example" /> <item android:state_focused="false" android:state_selected="true" android:state_pressed="true" android:drawable="@drawable/tab_selected_pressed_example" /> <!-- Focused states --> <item android:state_focused="true" android:state_selected="false" android:state_pressed="true" android:drawable="@drawable/tab_unselected_pressed_example" /> <item android:state_focused="true" android:state_selected="true" android:state_pressed="true" android:drawable="@drawable/tab_selected_pressed_example" /> </selector> 

我的可绘制文件是NinePatches,我使用这个有用的工具创build: http ://jgilfelt.github.io/android-actionbarstylegenerator/