0

I taking an image from a gallery and showing it in ImageView but, after setting the image in ImageView, its shape is completely distorted and it does not maintain the aspect ratio of the original.

Below is an image after setting in ImageView. How can I maintain the aspect ratio of the original?

enter image description here

Adrian Mole
  • 49,934
  • 160
  • 51
  • 83
Digvijay
  • 2,887
  • 3
  • 36
  • 86
  • Could you pass the image view tag in your xml code? How are you setting the image to image view ? Use android:adjustViewBounds=true. – Prashant.J Sep 29 '20 at 06:01
  • Does this answers your question, https://stackoverflow.com/questions/2521959/how-to-scale-an-image-in-imageview-to-keep-the-aspect-ratio – Prashant.J Sep 29 '20 at 06:02
  • I have tried `android:adjustViewBounds=true` and `android:scaleType="fitXY"` but nothing changed – Digvijay Sep 29 '20 at 07:04

0 Answers0