android:adjustViewBounds是否保持寬高比。需要與MaxWidth、MaxHeight一起使用,單獨使用沒有效果。
android:cropToPadding是否截取指定區域用空白代替。單獨設置無效果,需要與scrollY一起使用;
android:maxHeight定義View的最大高度,需要與AdjustViewBounds一起使用,單獨使用無效果。
如果想設置圖片固定大小,又想保持圖片寬高比,需要如下設置:
1設置AdjustViewBounds爲true;
2設置maxWidth、maxHeight;
3設置layout_width和layout_height爲wrao_content
androidLmaxWidth設置View的最大寬度。
android:scaleType設置圖片填充方式
android:src設置View的圖片顏色
android:tint將圖片渲染成指定的顏色