首页 > 移动平台 > 详细

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

时间:2020-01-19 15:50:38      阅读:902      评论:0      收藏:0      [点我收藏+]
<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"

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

原文:https://www.cnblogs.com/caosq/p/12213717.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!