android – ActionbarSherlock中homeAsUpIndicator图标的更改在ICS中不起作用?

我尝试更改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>

这段代码效果很好.尝试做那样的事情.可能它会帮助你.

祝好运!

相关文章

Android性能优化——之控件的优化 前面讲了图像的优化,接下...
前言 上一篇已经讲了如何实现textView中粗字体效果,里面主要...
最近项目重构,涉及到了数据库和文件下载,发现GreenDao这个...
WebView加载页面的两种方式 一、加载网络页面 加载网络页面,...
给APP全局设置字体主要分为两个方面来介绍 一、给原生界面设...
前言 最近UI大牛出了一版新的效果图,按照IOS的效果做的,页...