为什么安卓失去的图像质量显示的PNG文件时? [英] Why android lose image quality when displaying a png file?

查看:122
本文介绍了为什么安卓失去的图像质量显示的PNG文件时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要显示在Android PNG图像。这是图像文件:

I want to display a png image on android. This is the image file:

右端比左边暗一点。

但是图像的质量失去了对Android应用程序(使用ImageView的):

But the quality of image lost on android application(using ImageView):

请注意红框中的部分。颜色不平稳变化。

Please note part in the red frame. The color is not changing smoothly.

但是,如果我用我的Andr​​oid手机的浏览器,它起着良好的(所以它不是手机屏幕的原因):

But if I use the browser of my android phone, it plays good(so it's not reason of the phone screen):

这是我的Andr​​oid code,这是pretty简单:

This is my android code, which is pretty simple:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:orientation="vertical"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent">
    <ImageView android:layout_width="wrap_content"
               android:layout_height="wrap_content"
               android:background="@drawable/hhh"/>
</LinearLayout>

其中, HHH 是我贴在这里的第一形象,这是在 RES /绘制

where hhh is my first image posted here, which is under res/drawable.

我测试一下我的Andr​​oid手机(安卓2.3.6)和Android模拟器(采用Android 2.2 / 2.3 / 4.0),所有不显示良好。但是它扮演好我的Andr​​oid垫(安卓4.0.3)。

I test it on my android phone(android 2.3.6) and android simulator(with android 2.2/2.3/4.0), all do not display good. But it plays good on my android pad(android 4.0.3).

有什么问题,以及如何解决它?

What's the problem, and how to fix it?

推荐答案

图片RES /绘制是COM pressed。 这应该是无损,但我已经在过去听说过类似的问题

Images in res/drawable are compressed. This is supposed to be lossless, but I've heard of similar issues in the past.

将其插入 RES /原料,并给它一个去。

Move it into res/raw, and give it a go.

这篇关于为什么安卓失去的图像质量显示的PNG文件时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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