ImageView ScaleType 特点说明:
-
fitStart
居左或居上显示(视图片、Image宽高比而定),图片不变形、完整显示,铺满宽度或高度
-
fitEnd
和 fitStart 类似,方向改为居右或居下显示
-
fitCenter
居中显示,图片不变形、完整显示,铺满宽度或高度,
-
fitXY
撑满ImageView、完整显示图片,可能会拉升图片
-
center
居中显示图片实际像素,不保证撑满ImageView,不保证图片不被裁切
-
centerCrop
宽高均撑满ImageView,保证图片宽高,不保证完整显示,图片可能被拆切
-
centerInside
居中显示,保证图片不变形,保证图片显示完整,存在等比缩放,不拆切
-
matrix
居左、居上显示,不缩放,不拉伸,不保证撑满ImageView,可能发生拆切
Image Scale 特点 对照表
![](https://img.haomeiwen.com/i1944969/839c6a6c3ca55fe2.png)
Image Scale 特点 对照表.png
测试效果如下:
<ImageView
android:layout_width="match_parent"
android:layout_height="360dp"
android:scaleType="fitStart"
android:background="#FFF176"
android:src="@drawable/galaxy" />
![](https://img.haomeiwen.com/i1944969/2eaecfc03e8b9860.png)
原图 800*456 px.png
![](https://img.haomeiwen.com/i1944969/af29a4e554a79e21.png)
default.png
![](https://img.haomeiwen.com/i1944969/b8b93cdc2283756f.png)
fitCenter.png
![](https://img.haomeiwen.com/i1944969/08d35888ec3eb1b5.png)
fitStart height 360dp.png
![](https://img.haomeiwen.com/i1944969/7fdb2e59b9562684.png)
fitStart height 180dp.png
![](https://img.haomeiwen.com/i1944969/2bad5a65f81bc148.png)
fitEnd height 360dp.png
![](https://img.haomeiwen.com/i1944969/dd7f388240fbe152.png)
fitEnd height 180dp
![](https://img.haomeiwen.com/i1944969/9526183e90e5210f.png)
centerInside.png
![](https://img.haomeiwen.com/i1944969/c458a94204c935b9.png)
centerInside 100dp .png
![](https://img.haomeiwen.com/i1944969/caad999cfc1bad77.png)
centerCrop.png
![](https://img.haomeiwen.com/i1944969/8c64e019c2e3c5a6.png)
center.png
![](https://img.haomeiwen.com/i1944969/a0c0aa86e1337c2c.png)
center width 100 height 100.png
![](https://img.haomeiwen.com/i1944969/f9aa830a2954dc52.png)
fitXY.png
![](https://img.haomeiwen.com/i1944969/79a3e6b0b810cc0a.png)
matrix.png
网友评论