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"
   />

 

posted @ 2019-12-19 23:24  南极冰川雪  阅读(1221)  评论(0编辑  收藏  举报