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?
EDIT: 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>
EDIT: 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.
In the Library window, right-click (Windows) or control-click (Macintosh) on the bitmap and select Properties. Choose Lossless from the Compression pop-up menu and click OK. This will cause Flash to render the image at the original imported quality and will probably cause the SWF file size to increase considerably.
You can make a view clickable, as a button, by adding the android:onClick attribute in the XML layout. For example, you can make an image act like a button by adding android:onClick to the ImageView .
android:adjustViewBounds—If set to true, the attribute adjusts the bounds of the ImageView control to maintain the aspect ratio of the image displayed through it. android:resizeMode—The resizeMode attribute is used to make a control resizable so we can resize it horizontally, vertically, or around both axes.
ImageView is a control which display image on android and support RGB image, so setting the data of ImageView every period can generate dynamic video.
Banding occurs mostly when aspect ratio of the image is disturbed.
You could try any one of the following:
Make your image .9.png
. In that case, it will automatically fix any stretches and take care of banding.
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" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With