若你的parent layout就是整個螢幕的話
在layout屬性裡面加入以下兩行
android:scaleType="centerCrop"
android:adjustViewBounds="true"
就會填滿螢幕了
所以,完整的ImageView部分就會是這樣:
<ImageView
android:id="@+id/imageViewDemo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/demo.png"
android:scaleType="centerCrop"
android:adjustViewBounds="true"/>
除了centerCrop,還有各種的屬性可以填
center、centerInside、fitCenter、fitEnd、fitStart、fitXY、matrix
有興趣可以參考這篇討論:https://stackoverflow.com/questions/6669764/scale-an-image-up-to-fill-entire-imageview-in-android
還有官方說明:https://developer.android.com/reference/android/widget/ImageView#attr_android:scaleType