Fit image into ImageView, keep aspect ratio and then resize ImageView to image dimensions?

前端 未结 17 1082
无人共我
无人共我 2020-11-22 17:07

How to fit an image of random size to an ImageView?
When:

  • Initially ImageView dimensions are 250dp * 250dp
  • The image\'
17条回答
  •  被撕碎了的回忆
    2020-11-22 17:28

    this can all be done using XML... the other methods seem pretty complicated. Anyway, you just set the height to what ever you want in dp, then set the width to wrap content or visa versa. Use scaleType fitCenter to adjust the size of the image.

    
    

提交回复
热议问题