ImageView的adjustViewBounds属性再解读

------ adjustViewBounds属性要求api level 不小于18

 If the application targets API level 17 or lower, adjustViewBounds will allow the drawable to shrink the view bounds,
  but not grow to fill available measured space in all cases. 
  This is for compatibility with legacy MeasureSpec and RelativeLayout behavior.

------- 代码





    


ImageView的adjustViewBounds属性再解读_第1张图片


----------- 当我不限制ImageView的高度时





    
        
    




① 当不限制ImageView的高度,在原图宽高比为700:1120的情况下,图片宽度匹配了ImageView的最大宽度,高度不限制,所以adjustViewBounds属性实现了图片的宽度match_parent


ImageView的adjustViewBounds属性再解读_第2张图片


你可能感兴趣的:(ImageView)