android the image looks too small on screen, how to scale it to fit the screen? wrap_content does not seem to work

android, imageview

Solution

Add the following attribute to your ImageView to get it to scale as you like (will fill the size of your ImageView):

android:scaleType="fitXY"

I would actually change your width attribute as well. Your final XML could look like this:

<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"/>

Problem

android the image looks too small on screen, how to scale it to fit the screen? wrap_content does not seem to work ``` <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> ```

Original source

Related problems