可怕的ImageView位图的质量? [英] Horrible ImageView bitmap quality?

查看:95
本文介绍了可怕的ImageView位图的质量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有与的ImageView 播放的背景一方的启动画面。不管我是否让我的位图进行缩放(这是我做的),图像质量是可怕的。我认为这是降低颜色深度。我环顾四周SO已经和一个建议是,把我的形象在而不是绘制但没'牛逼帮助的。下面是截图:

I've got a splash screen with an ImageView playing the part of a background. Regardless of whether or not I allow my bitmap to be scaled (which I do), the image quality is horrible. I think it's reducing the color depth. I've looked around SO already and one suggestion was to place my image in raw instead of drawable but that didn't help either. Here is a screenshot:

究竟是怎么回事,如何解决呢?

What exactly is going on here and how do I fix it?

编辑:我没有申请此位编程,所以没有相关的Java code。下面是XML code为这项活动:

I didn't apply this bitmap programmatically so there's no relevant Java code. Here is the XML code for this activity:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/RelativeLayoutSplash"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:drawingCacheQuality="high"
    android:orientation="vertical"
    android:padding="@dimen/splash_padding"
    android:scrollbarAlwaysDrawVerticalTrack="true"
    tools:context=".SplashActivity" >

    <ImageView
        android:id="@+id/ImageViewBg"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:contentDescription="@string/logo_description"
        android:scaleType="centerCrop"
        android:src="@drawable/splash_bg_register" />

    <ImageView
        android:id="@+id/ImageViewLogo"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:contentDescription="@string/logo_description"
        android:maxHeight="@dimen/logo_maxheight"
        android:maxWidth="@dimen/logo_maxwidth"
        android:layout_centerVertical="true"
        android:src="@drawable/logo" />

    <TextView
        android:id="@+id/TextViewCopyright"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:text="@string/copyright"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:textColor="@color/white_50"
        android:textSize="@dimen/copyright_size" />

</RelativeLayout>

编辑:我试过 getWindow()和setFormat(PixelFormat.RGBA_8888); 的建议这让一个明显的区别,但条纹依然是present。 是我使用的背景图像。

I tried getWindow().setFormat(PixelFormat.RGBA_8888); as suggested which made a visible difference but the banding is still present. This is the image I'm using as the background.

推荐答案

捆扎大多发生在图像的长宽比被打乱。

Banding occurs mostly when aspect ratio of the image is disturbed.

您可以尝试以下的任何一个:

You could try any one of the following:

  1. 请你的形象 .9.png 。在这种情况下,它会自动修复任何伸展和照顾绑扎。

  1. Make your image .9.png. In that case, it will automatically fix any stretches and take care of banding.

适用于肤浅抖动你的形象可能prevent任何异常条带。

Apply superficial dithering to your image which might prevent any unusual banding.

<bitmap
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:src="@drawable/b1"
    android:tileMode="repeat"
    android:dither="true" />

这篇关于可怕的ImageView位图的质量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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