在项目中需要设置Imageview的最大宽高,以保证图片不会占用过大空间.但是设置android:maxWidth=”353dp”
android:maxHeight=”350dp”
并不能解决问题,后来通过
android:adjustViewBounds=”true”
属性解决了问题.以下是源码中对此方法的注解:
/**
Set this to true if you want the ImageView to adjust its bounds to preserve the aspect ratio of its drawable.
**/
设置ImageView最大高度和最大宽度无效
最新推荐文章于 2024-08-15 17:42:26 发布