可怕的ImageView位图质量?

Mic*_*man 6 android android-imageview

我有一个闪屏,ImageView播放背景的一部分.无论我是否允许我的位图缩放(我这样做),图像质量都很糟糕.我认为这会减少颜色深度.我已经环顾四周了,一个建议就是把我的形象放进去,raw而不是drawable那个也没用.这是一个截图:

在此输入图像描述

到底发生了什么,我该如何解决?

编辑:我没有以编程方式应用此位图,因此没有相关的Java代码.以下是此活动的XML代码:

<?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>
Run Code Online (Sandbox Code Playgroud)

编辑:我getWindow().setFormat(PixelFormat.RGBA_8888);按照建议尝试了一个明显的区别,但条带仍然存在.是我用作背景的图像.

Gau*_*ora 8

当图像的纵横比受到干扰时,主要发生条带化.

您可以尝试以下任何一种方法:

  1. 制作你的形象.9.png.在这种情况下,它会自动修复任何延伸并照顾条带.

  2. 对图像应用表面抖动,这可能会阻止任何异常的条带.

    <bitmap
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:src="@drawable/b1"
        android:tileMode="repeat"
        android:dither="true" />
    
    Run Code Online (Sandbox Code Playgroud)