Search code examples
androidandroid-layoutandroid-imageview

Remove white border around an ImageView


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" />

Solution

  •  <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.