How to auto center crop ImageView Android?
Solution 1:
I am not sure if I understood correctly. It must be either of the two, that you want, I guess.
In your image view set the attribute
android:scaleType="fitXY"
to fit the ImageView
completely.
You can choose
android:scaleType="centerCrop"
to crop Center.
Solution 2:
i know it's late but maybe it would be helpful for someone coming on this question page by using android:scaleType="centerCrop" image is centered but it is cropped from all sides so it would be better to use this property instead that is fitCenter and with this use another property too to maintain the aspect ratio
android:adjustViewBounds="true"
android:scaleType="fitCenter"
Solution 3:
Are you aware of the cropping options on ImageView?
http://developer.android.com/reference/android/widget/ImageView.ScaleType.html
You will just apply these as an attribute in your XML:
like:
android:scaleType="centerCrop"
Solution 4:
in java: imageView.setScaleType(ScaleType.FIT_XY);