ImageView ScaleType 特点说明:
-
fitStart
居左或居上显示(视图片、Image宽高比而定),图片不变形、完整显示,铺满宽度或高度
-
fitEnd
和 fitStart 类似,方向改为居右或居下显示
-
fitCenter
居中显示,图片不变形、完整显示,铺满宽度或高度,
-
fitXY
撑满ImageView、完整显示图片,可能会拉升图片
-
center
居中显示图片实际像素,不保证撑满ImageView,不保证图片不被裁切
-
centerCrop
宽高均撑满ImageView,保证图片宽高,不保证完整显示,图片可能被拆切
-
centerInside
居中显示,保证图片不变形,保证图片显示完整,存在等比缩放,不拆切
-
matrix
居左、居上显示,不缩放,不拉伸,不保证撑满ImageView,可能发生拆切
Image Scale 特点 对照表

Image Scale 特点 对照表.png
测试效果如下:
<ImageView
android:layout_width="match_parent"
android:layout_height="360dp"
android:scaleType="fitStart"
android:background="#FFF176"
android:src="@drawable/galaxy" />

原图 800*456 px.png

default.png

fitCenter.png

fitStart height 360dp.png

fitStart height 180dp.png

fitEnd height 360dp.png

fitEnd height 180dp

centerInside.png

centerInside 100dp .png

centerCrop.png

center.png

center width 100 height 100.png

fitXY.png

matrix.png
网友评论