问题描述
我使用的是可绘制类似以下为背景的渐变:
I'm using drawables like the following one for backgrounds with a gradient:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<gradient
android:startColor="#ffffff"
android:endColor="#cccccc"
android:angle="-90"
android:dither="true" />
</shape>
这导致带状梯度在模拟器上,当我走在仿真器(使用Eclipse)的屏幕截图,其结果是更差:
This results in a banded gradient on the emulator, and when I take a screenshot of the emulator (using Eclipse), the result is even poorer:
为什么呢?而如何解决这个问题?它虽然我使用安卓抖动=真正的
在可绘XML和活动设置此
的的onCreate()
:
Why? And how to solve this problem? It is although I'm using android:dither="true"
in the drawables' XML and setting this in the Activity
's onCreate()
:
getWindow().setFormat(PixelFormat.RGBA_8888);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DITHER);
顺便说一句,蓝色部分是本机操作栏和灰色梯度的ListView
行的背景绘制。
推荐答案
只是为了确保每个人谁读了这个问题看到了解决方案:的
由于 davehale23 和克里斯·斯特拉顿指出,这个问题是不是Eclipse或应用程序被偷拍。问题是,Android模拟器,这显然采用了降低位深度。
As davehale23 and Chris Stratton pointed out, the problem is not Eclipse or the app being "photographed". The problem is the Android emulator, which obviously uses a reduced bit depth.
因此,如果以一个应用程序的屏幕截图,每个人都应该使用真实的设备。
So if one takes screenshots of an app, one should always use a real device.
这篇关于Android的梯度可绘:截图在Eclipse中质量较差的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!