我尝试更改ActionBar中的homeAsUpIndicator图标.我使用ActionBarSherlock与较旧的
Android版本兼容.当App在具有较旧版本的ICS和ICS的设备上运行时,我为我的Activity设置了一个特定的主题,它显示了不同的颜色.
这是我正在使用的风格
<style name="Theme.PM" parent="@style/Theme.Sherlock.Light">
<item name="android:homeAsUpIndicator">@drawable/back_sign</item>
<item name="homeAsUpIndicator">@drawable/back_sign</item>
</style>
像这样下面的图像
对于ICS,看到家庭作为向上指示器看起来像黑色.
对于较早版本的ICS,请将该家作为向上指示器看起来像白色.
我在两个版本中使用相同的图像,但它在ICS上看起来有所不同.如何解决这个问题呢..
解决方法
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="CustomStyleUpAsHome" parent="Theme.Sherlock.Light">
<item name="android:actionBarStyle">@style/CustomActionBarUpAsHome</item>
<item name="android:homeAsUpIndicator">@drawable/arrow_home</item>
<item name="homeAsUpIndicator">@drawable/arrow_home</item>
</style>
<style name="CustomActionBarUpAsHome" parent="CustomActionBar">
<item name="android:displayOptions">homeAsUp|uselogo|showHome</item>
<item name="displayOptions">homeAsUp|uselogo|showHome</item>
</style>
</resources>
<activity
android:name=".activity.Activity"
android:screenorientation="portrait"
android:theme="@style/CustomStyleUpAsHome">
</activity>
这段代码效果很好.尝试做那样的事情.可能它会帮助你.
祝好运!