ImageView的adjustViewBounds屬性


adjustViewBounds屬性的定義如下:

調整ImageView的邊界,使得ImageView和圖片有一樣的寬高比

這個屬性只有在ImageView一邊如寬度或高度固定,一邊為wrap_content的時候才有意義,設置為true的時候,可以讓ImageView的比例和原始圖片一樣,以達到讓圖片充滿ImageView的效果。

<ImageView
       android:id="@+id/iv_image"
       android:layout_width="match_parent"
       android:layout_height="wrap_content"
       android:adjustViewBounds="true"
       android:background="@android:color/red"
       android:src="@drawable/cheese_1"
   />

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM