简体   繁体   English

删除 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:这是设计师的截图:

截屏

This is my XML code:这是我的 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" />

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 .尝试将android:adjustViewBounds="true"到您的ImageView

 <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.当我将 ImageView 用于 Splashscreen 时也经历了同样的事情,这 ^ 对我有用。

you might want to add it your image view only this.您可能只想将其添加到您的图像视图中。 It fixed my problem.它解决了我的问题。

android:paddingVertical="0dp"
android:paddingHorizontal="0dp"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM