为什么android在显示png文件时会丢失图像质量?

前端之家收集整理的这篇文章主要介绍了为什么android在显示png文件时会丢失图像质量?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我想在 android显示一个png图像.这是图像文件

右端比左侧略深.

但是在Android应用程序上丢失的图像质量(使用ImageView):

请注意红框中的部分.颜色没有平滑变化.

但是,如果我使用我的Android手机的浏览器,它播放效果很好(所以这不是手机屏幕的原因):

这是我的android代码,非常简单:

<?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 / drawable下.

我测试它在我的Android手机(Android 2.3.6)和Android模拟器(与Android 2.2 / 2.3 / 4.0),都显示不好.但它在我的android pad(android 4.0.3)上播放效果很好.

问题是什么,以及如何解决

解决方法

res / drawable中的图像被压缩. This is supposed to be lossless,但我过去听说过类似的问题.

将它移动到res / raw,然后试一试.

原文链接:https://www.f2er.com/android/309503.html

猜你在找的Android相关文章