最近做移動的簽批暂题,給ImageView設(shè)置Bitmap圖片啥纸。在簽批圖片寬度超出父窗體寬度的時候,ImageView的高度自適應(yīng)異常誓斥,表現(xiàn)的效果如圖只洒,上下留白(如圖)。
<ImageView
android:id="@+id/image1"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
而解決方案很簡單劳坑,添加android:adjustViewBounds="true" 屬性毕谴。
<ImageView
android:id="@+id/image1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true" />