Android ImageView adjustViewBounds不使用fitXY

Android ImageView adjustViewBounds不使用fitXY,android,button,imageview,scaletype,adjustviewbounds,Android,Button,Imageview,Scaletype,Adjustviewbounds,我使用以下代码来显示我的按钮 (因为我需要在按钮上添加文本,所以我不会使用ImageButton) 但是ImageView在视图中会有一些空白区域 我认为“fitXY”会占据整个视野,但事实并非如此 在这种情况下我该怎么办 感谢您的帮助:)设置android:layout\u width=“wrap\u content”并使用LinearLayout 最后 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/

我使用以下代码来显示我的按钮

(因为我需要在按钮上添加文本,所以我不会使用ImageButton)


但是ImageView在视图中会有一些空白区域

我认为“fitXY”会占据整个视野,但事实并非如此

在这种情况下我该怎么办


感谢您的帮助:)

设置
android:layout\u width=“wrap\u content”
并使用
LinearLayout

最后

<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="match_parent">
<ImageView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:src="@drawable/test"
    android:adjustViewBounds="true"
    android:scaleType="fitXY"/>

详情请参阅


使用填充缩放图像。在可用的宽度和高度内拉伸图片,降低纵横比。

这是因为您要使图像适合整个图像视图,那么调整绑定将如何工作。.buddyThanks,但是我需要按钮来填充宽度……和高度比例,但是我需要ImageView来填充宽度,我应该怎么做?然后使用android:scaleType=“fitCenter”和android:layout\u width='fill\u parent'@陳家錡 请回答,工作还是不工作?我真的为你感到抱歉,空白区域是阴影区域,因为图片来自UI设计
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="match_parent">
<ImageView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:src="@drawable/test"
    android:adjustViewBounds="true"
    android:scaleType="fitXY"/>