Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between 'center' and 'centerCrop' in the "ImageView"?

Tags:

android

xml

1-android:scaleTaype="center"

2-android:scaleTaype="centerCrop"

What is the difference between 1 and 2?

like image 484
M.younes Avatar asked Dec 23 '25 00:12

M.younes


1 Answers

CENTER :- Center the image in the view, but perform no scaling.

enter image description here

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). The image is then centered in the view. enter image description here

Refer to this official documentation for a overview of all the ScaleTypes and this site for a detailed explanation

like image 66
Mukul Kumar Jha Avatar answered Dec 24 '25 12:12

Mukul Kumar Jha