需求:
要求ImageView
宽度固定,图片缩放到与ImageView
宽度一致,ImageView
的高度根据图片的缩放比例对应缩放。
ImageView xml
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:gravity="bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:adjustViewBounds="true"
android:scaleType="fitXY"
android:src="@drawable/timg"
/>
</RelativeLayout>
原图:
效果图
注:图片取于网络,如有侵权,请联系删除
在使用Glide时,上述操作无效
可在Listener
或者into
使用Target
直接将图片设置到ImageView
上,不需要再加into(imageView)