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"


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM