gpt4 book ai didi

android imageview wrap_content

转载 作者:行者123 更新时间:2023-11-29 14:20:38 31 4
gpt4 key购买 nike

大家好,感谢您的帮助。

我在 Android Studio 中有一个项目。

我在垂直 LinearLayout 中使用 ImageView。

这是我的参数;

<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/imageView2"
android:src="@drawable/myimg"
/>

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

我想要这个是因为我希望该图像适合宽度,即使手机是纵向或横向也是如此。

enter image description here

最佳答案

我找到了解决方案android:adjustViewBounds="true"

关于android imageview wrap_content,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25995680/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com