更改线条颜色的标签 - ActionBarSherlock [英] Change line color in tabs - ActionBarSherlock

查看:120
本文介绍了更改线条颜色的标签 - ActionBarSherlock的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用ActionBarSherlock使与旧的设备我的应用程序兼容。实施是容易的,但现在我需要的风格,你的选项卡下看到一条红线默认的Holo蓝线。

I'm using ActionBarSherlock to make my app compatible with older devices. The implementation was easy, but now i need to style the default Holo blue line that you see under the tabs to a red line.

我一直在读几个主题(话题1 ,<一个href="http://stackoverflow.com/questions/10044303/actionbarsherlock-change-actionbar-line-colour">topic 2 )这里SO,也是ABS DOC(链接),但我不能让它的工作。

I've been reading a few topics (topic 1, topic 2) here on SO and also the ABS doc (link), but i can't get it to work.

这是我到目前为止所。

在我的Andr​​oidManifest.xml中添加此行到应用程序标记。

In my AndroidManifest.xml i added this line to the application tag.

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

然后在 RES /价值/ 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>

但是,当我跑我的应用程序,那么我仍然看到默认的蓝色线条颜色。

But when i run my app, then i still see the default blue line color.

我究竟做错了什么?

修改

阅读这个,如果你想完全风格你ActionBarSherlock!

,我发现这里的SO答案,得到以下链接: <一href="http://jgilfelt.github.com/android-actionbarstylegenerator">http://jgilfelt.github.com/android-actionbarstylegenerator

I found an answer here on SO which gave the following link: http://jgilfelt.github.com/android-actionbarstylegenerator

这是一个简单的发生器,产生所需的所有文件进行完全定制的ABS!所有你需要做的就是将生成的文件复制到此时,相应的文件夹和你设置!

It's an easy generator which generates all the needed files for a fully customized ABS! All you have to do is copy the generated files into the appropiate folders and you're set!

不要忘了启用样式(你必须输入样式名在发电机)在AndroidManifest。为此,请参阅下面的答案。

Don't forget to enable the style (you'll have to enter a style name in the generator) in your AndroidManifest. For that, see the answer below.

推荐答案

有几件事情:

您并不需要&LT;样式名称=AppTheme父=机器人:Theme.Light/&GT; 了,除非你想将其更改为继承 Theme.Sherlock ,并用它为你的应用程序的主题。如果你决定这样做,你将不得不使用 Theme.MyTheme 的活动。

You don't really need <style name="AppTheme" parent="android:Theme.Light" /> anymore unless you want to change it to inherit Theme.Sherlock and use it for your app theme. If you decide to do this you will have to use Theme.MyTheme for activities.

无论哪种方式,解决你想改变的问题

Either way, to fix the problem you want to change

<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" >

或者你也可以直接申请主题,你的活动:

OR you can apply the theme directly to your activities:

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

侧面说明,我建议这个优秀的动作条主题发电机

这篇关于更改线条颜色的标签 - ActionBarSherlock的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆