小编yuc*_*cel的帖子

android imageview wrap_content

大家好,感谢您的帮助.

我在Android Studio中有一个项目.

我在垂直LinearLayout中使用ImageView.

这是我的参数;

<ImageView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:id="@+id/imageView2"
    android:src="@drawable/myimg"
/>
Run Code Online (Sandbox Code Playgroud)

你可以看到我的图像下面(红色块)和imageview边框(蓝线)宽度没有问题,它是我的布局的%100,但我希望我的图像适合该区域同时保持纵横比.正如您在图像中看到的那样,有白色空间,ImageView高度比我的图像大,我如何在ImageView中拟合图像?

我想要这个,因为我希望那个图像适合宽度,即使手机是纵向或横向.

在此输入图像描述

android width imageview fill-parent

1
推荐指数
1
解决办法
3645
查看次数

标签 统计

android ×1

fill-parent ×1

imageview ×1

width ×1