Imageview.setAdjustViewBounds用法

public void setAdjustViewBounds (boolean adjustViewBounds)

当你需要在 ImageView调整边框时保持可绘制对象的比例时,将该值设为真。

参数 adjustViewBounds         是否调整边框,以保持可绘制对象的原始比例。

相关 XML 属性              android:adjustViewBounds

 

android:adjustViewBounds
是否保持宽高比。需要与maxWidth、MaxHeight一起使用,否则单独使用没有效果。  
  
设置View的最大高度,单独使用无效,需要与setAdjustViewBounds一起使用。如果想设置图片固定大小,又想保持图片宽高比,需要如下设置:
1) 设置setAdjustViewBounds为true;
2) 设置maxWidth、MaxHeight;
3) 设置设置layout_width和layout_height为wrap_content。

 

你可能感兴趣的:(Android)