Android图像在屏幕上看起来太小,如何缩放以适合屏幕?wrap_content似乎不起作用

Mic*_* SM 2 android imageview

Android图像在屏幕上看起来太小,如何缩放以适合屏幕?wrap_content似乎不起作用

<RelativeLayout
    android:id="@+id/layout"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
<ImageView
    android:layout_alignParentTop="true"
    android:layout_marginTop="100dip"
    android:id="@+id/imageview"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:src="@drawable/splash_screen"/>
<ProgressBar
    android:layout_alignParentBottom="true"
    android:layout_marginBottom="20dip"
    android:id="@+id/progressbar"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"/>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

Boo*_*ger 5

将以下属性添加到您的ImageView中以使其按需缩放(将填充ImageView的大小):

android:scaleType="fitXY"
Run Code Online (Sandbox Code Playgroud)

我实际上也会更改您的width属性。您的最终XML可能如下所示:

<ImageView
    android:layout_alignParentTop="true"
    android:layout_marginTop="100dip"
    android:id="@+id/imageview"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:scaleType="fitXY"
    android:src="@drawable/splash_screen"/>
Run Code Online (Sandbox Code Playgroud)