android: RoundCornerImageView 图片视图 倒圆角
最新推荐文章于 2024-05-13 15:27:44 发布
![](https://img-home.csdnimg.cn/images/20240709112858.png)
需求:固定大小的ImageView,但是大小不固定的ImageBitmap,想要使用这个大小不一的ImageBitmap填充满这个ImageView,从而让整个视图看起来整齐
这个可以直接在layout.xml这样实现的
<ImageView android:id="@+id/foodItem_foodImg"
android:src="@drawable/food_img_na"
android:layout_width="277dip"
android:layout_height="300dip"
android:scaleType="centerCrop"
/>
这里边的centerCrop的意思就是: Scale the image uniformly (maintain the image's aspect ratio) so that both dimensions (width and height) of the image will be equal to or larger than the corresponding dimension of the view (minus padding). 英语撇,就不翻译了,见谅。
参见:
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交
评论 4
![](https://csdnimg.cn/release/blogv2/dist/pc/img/closeBt.png)
![](https://csdnimg.cn/release/blogv2/dist/pc/img/commentArrowLeftWhite.png)
![](https://csdnimg.cn/release/blogv2/dist/pc/img/iconPark.png)
查看更多评论
![](https://csdnimg.cn/release/blogv2/dist/pc/img/commentArrowDownWhite.png)
添加红包
![](https://csdnimg.cn/release/blogv2/dist/pc/img/guideRedReward02.png)
![](https://csdnimg.cn/release/blogv2/dist/pc/img/guideRedReward03.png)