Scaling ImageView to device width

前端 未结 9 887
清酒与你
清酒与你 2020-12-05 00:54

In my Android App I have a Activity which show images which have following size 244 x 330. I want to show those images in full device width.

My layout f

9条回答
  •  無奈伤痛
    2020-12-05 01:54

    One of the ways to do it is by setting android:adjustViewBounds="true" to the ImageView and set the scale type to "fitCenter" in the xml file. This should work as expected. You can also do this programatically by setting ImageView.adjustViewBounds(true) and ImageView.setScaleType(ScaleType.FIT_CENTER).

提交回复
热议问题