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