The width and height of the ImageView control vary with the picture
•
Android
Original text: https://blog.csdn.net/qq_ 31207845/article/details/ 87881751@H_ 419_ 1@
android:adjustViewBounds="true" android:scaleType="fitXY"
Simply setting the ImageView scaletype to fitxy will inevitably stretch the image and destroy the original aspect ratio. Setting adjustviewbounds to true enables ImageView to maintain the aspect ratio of the image to be displayed when displaying the image to be displayed@ H_ 419_ 1@
Therefore, just these two lines of code can perfectly meet our above needs@ H_ 419_ 1@
Finally, pay special attention to the width and height settings of the ImageView. Set the width and height to wrap_ content. @H_ 419_ 1@
@H_ 419_ 1@
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码