I know about the matrix
, its structure and working about image view\'s scale-type. but,
I can\'t find the exact meaning of ImageView.ScaleTyp
The documentation you linked to provides the answer you are looking for.
Scale using the image matrix when drawing. The image matrix can be set using setImageMatrix(Matrix). From XML, use this syntax:
android:scaleType="matrix"
Although you mentioned that you already know what a Matrix
is in the context of graphics, I will explain briefly for the sake of other users who come across this question- A matrix can be used to manipulate the canvas when drawing graphics. In the case of an ImageView
's matrix, you can use it to translate, flip, rotate, or otherwise move the image around on the screen.
when i can use ImageView.ScaleType="MATRIX"
You can use it whenever you want with an ImageView
. You can call setScaleType() in your Java code to use a matrix scale type or you can add the android:scaleType="matrix"
attribute in your layout XML.
how it differs from FIT_END & FIT_START
FIT_END and FIT_START both actually use a Matrix
to scale your image. Both maintain the original aspect ratio and fit the image entirely within the view, but just align the result differently. End will align the scaled image to the end of the ImageView
, whereas start will align the scaled image to the start of the ImageView