如何改变动作条的颜色(actionbarsherlock) [英] How to change the color of actionbar (actionbarsherlock)

查看:210
本文介绍了如何改变动作条的颜色(actionbarsherlock)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何改变的动作条(actionbarsherlock)的颜色?

我已经试过低于code,但没有运气。

 <样式名称=MyTheme.ActionBarStyle父=Widget.Sherlock.ActionBar>
    <项目名称=背景>#FFFFFFFF< /项目>
< /风格>

<样式名称=Theme.SherlockCustom父=@风格/ Theme.Sherlock.Light>
    <项目名称=actionBarStyle> @风格/ MyTheme.ActionBarStyle< /项目>
< /风格>
 

+还有一件事,我是添加子菜单如下图所示。这个按钮的背景颜色也白(因为福尔摩斯主题)。可我改变这些颜色?

 子菜单子= menu.add(ABCD);
    sub.add(0,1,0,默认);
    sub.add(0,2,0,光);
    sub.add(0,3,0,浅(深行动吧));
    sub.getItem()setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT)。
 

解决方案

当谈到造型的动作条,最佳拍摄,你必须是使用非常流行的动作栏样式生成器这是一个Web应用程序,可以让你preVIEW方式的动作条的外观,让你下载所有必需的资产,简单地把它添加到你的产品:9patches,国家可绘制和.xmls。

如果您不知道如何使用,这里有一个快速指南

使用,这是在确保操作栏看起来非常的最佳拍摄,不浪费你很多时间,可以对有价值的Java code是最好用了。

How to change the color of actionbar (actionbarsherlock) ?

I've been tried below code but no luck.

<style name="MyTheme.ActionBarStyle" parent="Widget.Sherlock.ActionBar">
    <item name="background">#ffffffff</item>
</style>

<style name="Theme.SherlockCustom" parent="@style/Theme.Sherlock.Light">
    <item name="actionBarStyle">@style/MyTheme.ActionBarStyle</item>
</style>

+and one thing more, i'm add submenu like below. this button's background color is also white(because Sherlock Theme). could i change those colors?

    SubMenu sub = menu.add("abcd");
    sub.add(0, 1, 0, "Default");
    sub.add(0, 2, 0, "Light");
    sub.add(0, 3, 0, "Light (Dark Action Bar)");
    sub.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);

解决方案

When it comes to styling the actionBar, the best shot you have is to use the very popular Action Bar Style Generator which is a web app that will let you preview the way the ActionBar will look, and let you download all the necessary assets to simply add it to your product: 9patches, state-drawables, and .xmls.

If you are not sure how to use that, here's a quick guide.

Using this is the best shot at making sure the action bar looks great, without wasting much of your time that could be best spent on valuable Java Code.

这篇关于如何改变动作条的颜色(actionbarsherlock)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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