如何在 Android Studio 中删除 imageView 的边框?

How can I remove borders for imageView in Android Studio?

我尝试将 android:adjustViewBounds="true" 添加到我的图片中,但它没有任何作用。我怎样才能越过边界?我的图片是一个 512x512 的图标。

<ImageView android:id="@+id/imageView" android:background="@drawable/needle" android:layout_below="@+id/textview2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:adjustViewBounds="true" />

您的图片不要使用 android:background="@drawable/needle",而是使用 android:src="@drawable/needle"android:background="@drawable/needle" 用于设置背景 要显示在图像视图上的图像后面。编辑:OP 想让这条线从视图的左侧延伸到右侧。将 layout_width="wrap_content" 更改为 layout_width="match_parent" 应该可以解决问题。