Android调整图像大小以适应屏幕大小



我在Android中有一个ImageView,它从URL加载图像,加载的图像大小是500*500。当图像加载到一个小屏幕上时,它适合屏幕的所有宽度,高度是可以接受的。然而,在更大的屏幕上,图像会变得非常非常小,为什么?我该如何解决这个问题?

<ImageView
    android:id="@+id/items_image"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/items_name"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="50dp"
    android:adjustViewBounds="true"
    android:scaleType="fitXY"
    android:src="@drawable/cross_blank" />

尝试将宽度和高度更改为

android:layout_width="fill_parent"
android:layout_height="fill parent"

ImageView放在linearlayout中,并将布局的宽度和高度也设置为fill_parent

根据您的布局,更改为

android:layout_width="match_parent"
android:layout_height="wrap_content"

android:layout_width="wrap_content"
android:layout_height="match_parent"

最新更新