Android – how to display the trimmed ImageView so that the height is equal to the width?

I need to make an Android application that displays square images. But it receives images with width greater than height. But you need to display squares

This is what I have

That's what I need

resolvent:

You can use the following two parameters in the ImageView of XML:

android:adjustViewBounds="true"
android:scaleType="centerCrop"

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
分享
二维码
< <上一篇
下一篇>>