android – 更改选项卡中的线条颜色 – ActionBarSherlock

我正在使用ActionBarSherlock使我的应用程序与旧设备兼容.实现很简单,但现在我需要将您在标签下看到的认Holo蓝线设置为红线.

我一直在这里阅读一些主题(topic 1,topic 2)和ABS文档(link),但我无法让它发挥作用.

这就是我到目前为止所拥有的.

在我的AndroidManifest.xml中,我将此行添加到应用程序标记中.

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/Theme.Sherlock" > <!-- SET THE DEFAULT THEME -->

然后在res / values / styles.xml中我有

<resources>
    <style name="AppTheme" parent="android:Theme.Light" />

    <style name="Theme.MyTheme" parent="Theme.Sherlock">
        <item name="actionBarStyle">@style/Widget.MyTheme.ActionBar</item>
        <item name="android:actionBarStyle">@style/Widget.MyTheme.ActionBar</item>
    </style>

    <style name="Widget.MyTheme.ActionBar" parent="Widget.Sherlock.ActionBar">
        <item name="android:background">#ff000000</item>
        <item name="background">#ff000000</item>
    </style>
</resources>

但是当我运行我的应用程序时,我仍然看到认的蓝线颜色.

我究竟做错了什么?

编辑

如果您想完全设计ActionBarSherlock样式,请阅读此内容

我在SO上找到了一个答案,它提供了以下链接
http://jgilfelt.github.com/android-actionbarstylegenerator

它是一个简单的发电机,可为完全定制的ABS生成所有需要的文件!您所要做的就是将生成文件复制到适当的文件夹中,然后进行设置!

不要忘记在AndroidManifest中启用样式(您必须在生成器中输入样式名称).为此,请参阅下面的答案.

解决方法

一些东西:

你真的不需要< style name =“AppTheme”parent =“android:Theme.Light”/>除非您想要更改它以继承Theme.Sherlock并将其用于您的应用主题.如果您决定这样做,您将不得不使用Theme.MyTheme进行活动.

无论哪种方式,解决您想要更改的问题

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/Theme.Sherlock" >

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/Theme.MyTheme" >

或者您可以将主题直接应用于您的活动:

<activity 
    android:name="com.awesome.package.activity.someActivity"
    android:theme="@style/Theme.MyTheme"/>

旁注,我推荐这个excellent actionbar theme generator

相关文章

Android性能优化——之控件的优化 前面讲了图像的优化,接下...
前言 上一篇已经讲了如何实现textView中粗字体效果,里面主要...
最近项目重构,涉及到了数据库和文件下载,发现GreenDao这个...
WebView加载页面的两种方式 一、加载网络页面 加载网络页面,...
给APP全局设置字体主要分为两个方面来介绍 一、给原生界面设...
前言 最近UI大牛出了一版新的效果图,按照IOS的效果做的,页...