android ImageVIew的缩放属性scaleType的几种参数解释.
ImageView.ScaleType
http://developer.android.com/reference/android/widget/ImageView.ScaleType.html
CENTER //Center the image in the view, but perform no scaling.
//在view中心位置显示图片,但不进行缩放
//如果图片过大,则裁剪显示中心一部分
//如果图片较小,则在imageView中心显示,不会充满imageView

CENTER_CROP
|
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). |

//按比例缩放图片,最终让图片的宽高都大于或等于imageView的宽高
//如果图片过大,则按比例缩小图片,裁剪一部分图片充满imageView.(宽or高其中一个会与imageView相同).
//如果图片较小,则按比例放大图片,裁剪一部分图片充满imageView.(宽or高其中一个会与imageView相同).
CENTER_INSIDE
|
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 less than the corresponding dimension of the view (minus padding). |
/按比例缩放图片,最终让图片的宽高都小于或等于imageView的宽高
//如果图片过大,则按比例缩小图片,不会裁剪图片,无法充满imageViewimageView(宽or高其中一个会与imageView相同).
//如果图片较小,不会放大图片

FIT_CENTER /END /START
|
Matrix.ScaleToFit CENTER /END /START Compute a scale that will maintain the original src aspect ratio, but will also ensure that src fits entirely inside dst. At least one axis (X or Y) will fit exactly. START aligns the result to the left and top edges of dst./left and top |
//按比例缩放,并且确保原图片能完全显示在imageView中.x/y轴方向至少一个完全匹配大小.
//START/END/CENTER决定缩放后的图片的对齐方式.分别是左上/右下/中间
START
END
CENTER
FITXY
Scale in X and Y independently, so that src matches dst exactly. This may change the aspect ratio of the src.
//缩放图片,完全匹配imageView的大小,所以可能改变图片的宽高比.

MATRIX

//matrix.从左上如实画满imageView,会裁剪图片.
//不设置 默认fitCenter.
//fitCenter和centerInside的区别在于如果图片过小,fitCenter是会放大的,而centerInside是不会放大的.
浙公网安备 33010602011771号