android ImageView 图片宽度全屏,高度自适应的写法

<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:scaleType="fitXY"
android:src="@drawable/res_version_bg" />
<!-- Set this to true if you want the ImageView to adjust its bounds
to preserve the aspect ratio of its drawable. -->

如果希望ImageView调整其边界,请将此设置为true 以保持其可拉伸的长宽比

<attr name="adjustViewBounds" format="boolean" />
把图片按比例扩大/缩小到View的宽度,显示在View的上部分位置
android:scaleType="fitXY"

猜你喜欢

转载自www.cnblogs.com/caosq/p/12213717.html
今日推荐