如何将随机大小的图像拟合到ImageView?
什么时候:
ImageView尺寸为250dp*250dpImageView缩放后,尺寸应与缩放图像的尺寸相匹配例如,对于100*150的图像,图像ImageView应为166*250.
例如,对于150*100的图像,图像ImageView应为250*166.
如果我将界限设置为
<ImageView
android:id="@+id/picture"
android:layout_width="250dp"
android:layout_height="250dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="20dp"
android:adjustViewBounds="true" />
Run Code Online (Sandbox Code Playgroud)
图像适合在ImageView,但ImageView总是250dp*250dp.