android - 按下时如何更改主页按钮突出显示颜色

标签 android android-actionbar actionbarsherlock

我使用 Sherlock 操作栏

1,我想在按下时将主页按钮 BG 从蓝色更改为红色

2,我想更改 HomeAsUp 图标(白色箭头)有什么想法吗?

enter image description here 主页按钮

enter image description here 按下

这里创建了这个actionbar代码

extends SherlockFragmentActivity

public ActionBar actionBar;

this.actionBar = this.getSupportActionBar();
this.actionBar.setDisplayShowHomeEnabled(true);
this.actionBar.setHomeButtonEnabled(true);
this.actionBar.setDisplayHomeAsUpEnabled(true);

最佳答案

您可以通过在主题中指定自己的 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>

然后在您的 Activity 的 list 中指定 Theme.MyTheme

关于android - 按下时如何更改主页按钮突出显示颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11202138/

相关文章:

java - 如何在Android中渲染YV12视频帧

Android Firebase 身份验证不起作用

android - SherlockFragment 无法转换为 Fragment,我的 Activity 是 SherlockActivty

java - dx.bat 上的错误类文件魔法

Android 4.0.4 没有出现在我的 Android SDK 管理器中

java - 在android中存储和获取共享首选项的值

android - ActionBarSherlock:选项卡在横向模式下丢失自定义 View

android - 通知/标题栏下的 ActionBar

android - 在 ActionBar 的菜单项上添加复选框

android - ActionBarSherlock 背景不会在 ICS 之前的版本上重复