【问题标题】:Sherlock Action bar color change夏洛克动作条颜色变化
【发布时间】:2014-10-07 15:42:50
【问题描述】:

现在只想更改操作栏颜色我正在使用Theme.Sherlock.Light.Dark_Action Bar 需要改变颜色应该支持api 10及以上

【问题讨论】:

  • 到目前为止你还没有什么?也发布你的 style.xml
  • schemas.android.com/apk/res/android">

标签: android actionbarsherlock background-color


【解决方案1】:

您可以将drawable添加到Actionbar..

getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.header_drawable_xml));

这里是 header_drawable_xml

<shape android:shape="rectangle"
  xmlns:android="http://schemas.android.com/apk/res/android">
    <gradient android:startColor="YOUR COLOR" >>YOUR COLOR android:endColor="YOUR COLOR" >> android:angle="270.0" />
     <padding
            android:left="10dp"
            android:top="10dp"
            android:right="10dp"
            android:bottom="10dp" />
</shape>

【讨论】:

    【解决方案2】:

    我使用了以下代码,它可以工作

    getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#00853c")));
    

    希望它对你有用..

    【讨论】:

    • 我正在使用夏洛克操作栏
    • 嘿,您可以通过此链接自定义您的夏洛克操作栏jgilfelt.github.com/android-actionbarstylegenerator
    • 需要为菜单项应用相同的操作栏颜色..回复
    • 查看同一链接上的“弹出颜色”属性以更改菜单、子菜单背景......您必须为操作栏和弹出颜色属性保持相同的颜色
    • 我只使用了这个代码getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#00853c")));
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多