5
我一直在尝试几天来重写自定义选项卡样式的全息主题,但我的更改没有任何效果。为什么我的自定义'actionBarTabStyle'不覆盖默认样式/主题?
这里是我的styles.xml
<!-- the theme applied to the application or activity -->
<style name="CustomActionBarTheme" parent="@android:style/Theme.Holo">
<item name="android:tabWidgetStyle">@style/MyActionBarTabs</item>
</style>
<!-- ActionBar tabs styles -->
<style name="MyActionBarTabs" parent="@android:style/Widget.Holo.ActionBar.TabView">
<!-- tab indicator -->
<item name="android:background">@drawable/tabselector</item>
</style>>
这是我tabselector.xml
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Non focused states -->
<item android:drawable="@drawable/tab_unselected_holo" android:state_focused="false" android:state_pressed="false" android:state_selected="false"/>
<item android:drawable="@drawable/tab_selected_holo" android:state_focused="false" android:state_pressed="false" android:state_selected="true"/>
<!-- Focused states -->
<item android:drawable="@drawable/tab_unselected_focused_holo" android:state_focused="true" android:state_pressed="false" android:state_selected="false"/>
<item android:drawable="@drawable/tab_selected_focused_holo" android:state_focused="true" android:state_pressed="false" android:state_selected="true"/>
<!-- Pressed -->
<!-- Non focused states -->
<item android:drawable="@drawable/tab_unselected_pressed_holo" android:state_focused="false" android:state_pressed="true" android:state_selected="false"/>
<item android:drawable="@drawable/tab_selected_pressed_holo" android:state_focused="false" android:state_pressed="true" android:state_selected="true"/>
<!-- Focused states -->
<item android:drawable="@drawable/tab_unselected_pressed_holo" android:state_focused="true" android:state_pressed="true" android:state_selected="false"/>
<item android:drawable="@drawable/tab_selected_pressed_holo" android:state_focused="true" android:state_pressed="true" android:state_selected="true"/>
</selector>
我已在我的活动使用TabHost标签和它的布局看起来像这样
<android.support.v4.app.FragmentTabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TabWidget
android:id="@android:id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0"
android:orientation="horizontal" />
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="0" />
<FrameLayout
android:id="@+id/realtabcontent"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
</LinearLayout>
</android.support.v4.app.FragmentTabHost>
我遵循Android Developer Page的示例
我的标签看起来还是一样的。 我的标签指标应该是我自定义的粉红色。但是,没有变化,他们仍然是蓝色的。
注意事项:
- 我的清单文件引用更新的主题在我的应用程序标签
- 我styles.xml在每个值更新的文件夹(值,值-V11,价值观-V14)
- 这一切都被添加在我的应用程序的顶部的操作栏与我ic_launcher图像和标题
我缺少什么或者做错了吗?感谢任何帮助。谢谢你们!
感谢您的快速反应。做过某事。它绝对改变了标签下面的发际线......但是,蓝色的指示颜色仍然存在。我想我可以看到粉红色隐藏在蓝色下......但它仍然重叠。 –
在style.xml中更新了我的代码,以在您的建议中显示编辑 –
@MarkBarrasso我使用完整示例进行了编辑。 – adneal