gpt4 book ai didi

java - 如何在不改变ImageView宽度的情况下设置图像的宽度(在ImageView中)?

转载 作者:行者123 更新时间:2023-12-01 17:30:04 25 4
gpt4 key购买 nike

我想要做的是更改 ImageView 中图像的宽度,而不影响 ImageView 的宽度。

    ----------------------------------------------------------------
| |
| |
| ---------------------------------------------- |
| | | |
| | | |
| | this is the image( change its width) | |
| | | |
| ---------------------------------------------- |
| |
| this is imageView the width mustnt change |
----------------------------------------------------------------

我怎样才能实现这个目标?请帮忙?

最佳答案

您可以使用 ScaleType 来实现此目的。就像,

imgV.setScaleType(ImageView.ScaleType.CENTER_CROP);

您也可以指定 Padding 属性。

查看可能对您有帮助的链接。

Android ImageView adjusting parent's height and fitting width

关于java - 如何在不改变ImageView宽度的情况下设置图像的宽度(在ImageView中)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11981538/

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