按下时如何更改HomeButton Hilight Color

Int*_*hep 13 android actionbarsherlock android-actionbar

我使用Sherlock Actionbar

1,当我从蓝色按到红色时,我想更换Home Button BG

2,我想改变HomeAsUp图标(白色箭头)的想法吗?

在此输入图像描述 主页按钮

在此输入图像描述 压制

这里创建了这个操作栏代码

extends SherlockFragmentActivity

public ActionBar actionBar;

this.actionBar = this.getSupportActionBar();
this.actionBar.setDisplayShowHomeEnabled(true);
this.actionBar.setHomeButtonEnabled(true);
this.actionBar.setDisplayHomeAsUpEnabled(true);
Run Code Online (Sandbox Code Playgroud)

Jak*_*ton 19

您可以通过actionBarItemBackground在主题中指定自己的属性来更改此设置.

例如,

<style name="Theme.MyTheme" parent="Theme.Sherlock">
    <item name="android:actionBarItemBackground">@drawable/my_cool_drawable</item>
    <item name="actionBarItemBackground">@drawable/my_cool_drawable</item>
</style>
Run Code Online (Sandbox Code Playgroud)

然后Theme.MyTheme在清单中指定您的活动.