一个简单的需求,将图片的宽度固定扩到到屏幕宽度,高度等比例放大。
利用
android:adjustViewBounds="true"
配合MaxWidth和MaxHeight
(adjustViewBounds表示宽高比例固定,要配合MaxWidth和MaxHeight才有效果)
<--表示图片宽度屏幕自适应,高度根据宽度放缩比例进行放缩-->
<ImageView
android:id="@+id/sdv_article"
android:adjustViewBounds="true"
android:layout_gravity="center_horizontal"
android:layout_width="match_parent"
android:layo