Remove white border around an ImageView

10,111

Solution 1

 <ImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:adjustViewBounds="true"
        android:id="@+id/imageView"
        android:cropToPadding="false"
        android:scaleType="fitXY" />

Experienced the same when I used an ImageView for Splashscreen, this^ worked for me.

Solution 2

It looks like the image is larger than the screen width, so it's getting scaled down after sizing. Try adding android:adjustViewBounds="true" to your ImageView.

Share:
10,111
medphys
Author by

medphys

Updated on June 29, 2022

Comments

  • medphys
    medphys almost 2 years

    My designer keeps adding a little padding around my image. I want the image the stick on the top and to fill out the width of the screen.

    Here's a screenshot from the designer:

    Screenshot

    This is my XML code:

    <ImageView
        android:id="@+id/markertap_header"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:src="@drawable/header_bootsverleih_xhdpi" />