Remove white border around an ImageView

2019-05-10 10:25发布

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: http://imgur.com/zsck8

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

2条回答
做自己的国王
2楼-- · 2019-05-10 10:47

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.

查看更多
老娘就宠你
3楼-- · 2019-05-10 10:49
 <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.

查看更多
登录 后发表回答