ImageView fills parent's width OR height, but maintains aspect ratio

后端 未结 7 552
礼貌的吻别
礼貌的吻别 2020-12-04 18:07

I have a square image (though this problem also applies to rectangular images). I want to display the image as large as possible, stretching them if necessary, to fill thei

7条回答
  •  [愿得一人]
    2020-12-04 18:19

    These:

    android:layout_height="wrap_content"
    android:scaleType="fitStart"
    android:adjustViewBounds="true"
    

    should resize the image and change the size of the bounds to fit the new image size. If it does not do that on your device post the image you are using and what device you are testing on.

提交回复
热议问题