Android的渐变可绘制对象:Eclipse中的屏幕截图质量较差 [英] Android's gradient drawables: poor quality of screenshots in Eclipse

查看:128
本文介绍了Android的渐变可绘制对象:Eclipse中的屏幕截图质量较差的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下类似的可绘制对象作为渐变背景:

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中使用 android:dither ="true" 并将其设置在 Activity 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 行.

By the way, the blue part is the native action bar and the grey gradients are ListView rows with the background drawable.

推荐答案

只是要确保阅读此问题的每个人都能看到解决方案:

正如 davehale23 Chris Stratton 所指出的那样,问题不是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中的屏幕截图质量较差的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆