我需要一些操作栏和选项卡视图自定义方面的帮助。我使用夏洛克动作栏库,并尝试将自定义选项卡/动作栏样式与主题绑定,作为我的活动的父项。BUt 它不起作用,没有错误,但没有任何变化。我做错了什么?
以下是我的样式:(至少更改背景颜色):
<style name="AppBaseTheme" parent="Theme.Sherlock">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
<item name="android:actionBarStyle">@style/MyActionBar</item>
<item name="actionBarStyle">@style/MyActionBar</item>
<item name="android:actionBarTabBarStyle">@style/MyActionBarTabBar</item>
<item name="actionBarTabBarStyle">@style/MyActionBarTabBar</item>
<item name="android:actionBarTabStyle">@style/MyActionBarTab</item>
<item name="actionBarTabStyle">@style/MyActionBarTab</item>
</style>
<style name="MyActionBar" parent="Widget.Sherlock.ActionBar">
<item name="android:background">@android:color/white</item>
</style>
<style name="MyActionBarTabBar" parent="Widget.Sherlock.ActionBar.TabBar">
<item name="android:background">@android:color/black</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">match_parent</item>
</style>
<style name="MyActionBarTab" parent="Widget.Sherlock.ActionBar.TabView">
<item name="android:background">@android:color/white</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">wrap_content</item>
</style>
这是我的清单:
<application
android:icon="@drawable/ic_launcher"
android:logo="@drawable/abs__ic_go"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".FragmentTabsPager"
android:label="@string/app_name"
android:theme="@style/AppTHeme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
我尝试分别使用CUstomTabs和Theme.Styled(for ActionBar)样式,但没有结果。
<style name="Widget.Sherlock.ActionBar.TabView" parent="Widget.Sherlock.ActionBar.TabView">
您不应该对样式使用相同的名称,例如要扩展的父样式。安卓应该如何知道该选择哪一个?
有效名称应包含用于标识的主题名称:
<style name="AppTheme.ActionBar.TabView" parent="Widget.Sherlock.ActionBar.TabView">