最近做移動的簽批,給ImageView設(shè)置Bitmap圖片。在簽批圖片寬度超出父窗體寬度的時候,ImageView的高度自適應(yīng)異常,表現(xiàn)的效果如圖,上下留白(如圖)。
<ImageView
android:id="@+id/image1"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

Screenshot_2017-02-28-19-21-29.png
而解決方案很簡單,添加android:adjustViewBounds="true" 屬性。
<ImageView
android:id="@+id/image1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true" />