天天看點

Android - 設定ImageView為全屏顯示

設定ImageView為全屏顯示

本文位址: http://blog.csdn.net/caroline_wendy

本文的合集已經編著成書,《進階Android開發強化實戰》,歡迎各位讀友的建議和指導。

在京東即可購買:https://item.jd.com/12385680.html

Android - 設定ImageView為全屏顯示

ImageView預設會适應螢幕大小, 如果想使用全屏填充, 則需要使用:

android:scaleType="fitXY"
android:scaleType="matrix"
           

注意android:scaleType的參數選擇.

參考: http://developer.android.com/reference/android/widget/ImageView.html#attr_android:scaleType

整體界面:

<ImageView
        android:layout_height="match_parent"
        android:layout_width="match_parent"
        android:scaleType="fitXY"
        android:src="@drawable/healthvideo_background_xxx"/>