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