How to configure an image in Imageview so that it takes the entire screen of the phone

Asked

Viewed 5,781 times

1

The following I declare normal to ImageView :

<ImageView
    android:id="@+id/imageView1"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:src="@drawable/imagem"/>

but the image does not occupy the whole screen.

2 answers

6


Try including the following property:

android:scaleType="fitXY"

However, depending on your image, it may not maintain the same quality and proportion, so you have to use a good image for this.

2

First, use MATCH_PARENT when you want your View occupy all screen space. Property FILL_PARENT was discontinued from API 8.

Take a look at the parameter android:adjustViewBounds to make your ImageView resize itself to adapt to your rescaled image.

Then, you can change the way your image is resized using the parameter android:scaleType, here you can see the properties that best suit you.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.