删除ImageView周围的白色边框

med*_*hys 4 android android-layout android-imageview

我的设计师不断在我的图像周围添加一些填充物.我希望图像贴在顶部,并填写屏幕的宽度.以下是设计师的截图:http://imgur.com/zsck8

这是我的XML代码:

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

kco*_*ock 10

看起来图像大于屏幕宽度,因此在调整大小后会缩小图像.尝试添加android:adjustViewBounds="true"到您的ImageView.


Ani*_*h M 8

 <ImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:adjustViewBounds="true"
        android:id="@+id/imageView"
        android:cropToPadding="false"
        android:scaleType="fitXY" />
Run Code Online (Sandbox Code Playgroud)

当我使用Splashscreen的ImageView时经历了同样的事情,这对我很有用。

  • 这个答案要好得多,因为它在每种情况下都完美地“修剪”了图像。 (2认同)