Android的渐变画面:Eclipse中截图质量差 [英] Android's gradient drawables: poor quality of screenshots in Eclipse

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

问题描述

我正在使用像下面一样的可绘制的背景,其中包含渐变的背景:

 <?xml version =1.0 encoding =utf-8?> 
< shape xmlns:android =http://schemas.android.com/apk/res/androidandroid:shape =rectangle>
< gradient
android:startColor =#ffffff
android:endColor =#cccccc
android:angle = - 90
android:dither =true/>
< / shape>

这将导致模拟器上的带状渐变,当我拍摄模拟器的截图(使用Eclipse),结果更差:





为什么?又如何解决这个问题?虽然我在可绘制的XML中使用 android:dither =true,并在 Activity onCreate()

  getWindow()。setFormat PixelFormat.RGBA_8888); 
getWindow()。addFlags(WindowManager.LayoutParams.FLAG_DITHER);

顺便说一句,蓝色部分是原生动作栏,灰色渐变是 ListView 具有背景绘制的行。

解决方案

只是为了确保每个人阅读这个问题看到解决方案:



由于 davehale23 Chris Stratton 指出,问题不是Eclipse或该应用程序被拍摄。问题是Android模拟器,它显然使用了一个减少的位深度。



所以如果一个应用程序的屏幕截图,应该总是使用一个真正的设备。 >

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>

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:

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);

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

解决方案

Just to make sure everyone who reads this question sees the solution:

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天全站免登陆