今天有个需求是把整张图片填充到整个页面,于是全都设置成match
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/xfgl"
>
但是发现图片的上下两部分还留有空白,没有完全铺满,于是就使用scaleType属性来解决
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/xfgl"
android:scaleType="fitXY"/>
问题搞定。。
补充:发现一篇对scaleType做了比较好的分析的文章
本文介绍了一种将图片填充至整个页面的方法,通过调整ImageView的属性实现图片全屏显示,解决了图片上下留白的问题,并分享了scaleType属性的使用技巧。
5870

被折叠的 条评论
为什么被折叠?



