如何改变在Android的ActionMode背景颜色 [英] How to change ActionMode background color in Android

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

问题描述

我创建一个Android应用程序的支持级别的API是7,所以我使用夏洛克动作条。我使用的动作模式在里面。 问题是我要改变行动方式的背景。所以,我试图

i am creating an android app in which support level api is 7 so i am using sherlock actionbar. I am using action mode in it. Issue is i want to change the background of action mode. So i have tried

    <item name="android:background">@color/something</item>
    <item name="android:backgroundStacked">@color/something</item>
    <item name="android:backgroundSplit">@color/something</item>

这些风格的解决方案其中的可用,但没有工作。

these style solution's available but none of them works.

推荐答案

如果你想改变动作条的颜色只是这样做:

if you want change the color of ActionBar just do this:

 ActionBar bar = getActionBar();
 bar.setBackgroundDrawable(new ColorDrawable("COLOR"));

请参阅下面的<一个href="http://stackoverflow.com/questions/8024706/how-do-i-change-the-background-color-of-the-actionbar-of-an-actionbaractivity-us">link更多资讯

如果你使用ActionMode这是用于任何ActionMode风格。你需要创建自己的风格来定制它

and if you using ActionMode This is the style used for any ActionMode. You'll need to create your own style to customize it

<style name="Widget.ActionMode">
<item name="android:background">?android:attr/actionModeBackground</item>
<item name="android:backgroundSplit">?android:attr/actionModeSplitBackground</item>
<item name="android:height">?android:attr/actionBarSize</item>
<item name="android:titleTextStyle">@android:style/TextAppearance.Widget.ActionMode.Title</item>
<item name="android:subtitleTextStyle">@android:style/TextAppearance.Widget.ActionMode.Subtitle</item>
</style>

更<一个信息href="http://stackoverflow.com/questions/6556116/how-can-i-customize-the-action-modes-color-and-text">this网站

​​这个的太

修改

为pre-蜂窝看到<一href="http://www.miximum.fr/tutos/849-porting-the-contextual-anction-mode-for-$p$p-honeycomb-android-apps">this请

也许<一href="http://wptrafficanalyzer.in/blog/creating-contextual-action-mode-for-single-views-in-$p$p-honeycomb-versions-using-sherlock-library/">this或<一href="http://stackoverflow.com/questions/13531272/state-activated-on-$p$p-honeycomb-devices">this帮你

这篇关于如何改变在Android的ActionMode背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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