左边是 Gingerbread (2.3.3) 模拟器,右边是 ICS (4.0.3) 模拟器。注意红色框内的渐变淡入淡出效果差异(在单独的窗口中打开以查看全尺寸图像)。
主视图背景:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/app_bg"
android:orientation="vertical" >
...
</LinearLayout>
app_bg.xml
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient android:startColor="#000" android:centerColor="#333"
android:endColor="#000" android:angle="270" />
</shape>
是什么导致了这个问题?如何解决这个问题,使 ICS 渐变看起来像 2.3.3 版本一样平滑?问题是否只出现在模拟器上?
最佳答案
我认为问题在于 android(在右侧)使用较少的颜色绘制渐变。我相信您希望启用抖动以帮助掩饰颜色深度的下降。也许看到这个答案link
我不完全确定它是如何工作的,但我相信 android 有时会默认为 RGB_565 模式,即使设备支持 24 位颜色。
关于android - 渐变兼容性问题 - ICS 默认使用的颜色比所有以前版本的 Android 都少,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8636388/