Sherlock动作栏颜色变化

时间:2014-08-14 05:03:54

标签: android actionbarsherlock background-color

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

2 个答案:

答案 0 :(得分:5)

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

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

希望它对你有用..

答案 1 :(得分: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>
相关问题