0

I have to put an ImageView inside a RelativeLayout. Just like this:

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">
    <ImageView
            android:id="@+id/imagen"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:scaleType="centerInside"
            android:src="@drawable/image1"/>
</RelativeLayout>

I know that this image will be resized in some devices because it would be too big for the device's screen. The remaining resized layout is something like this, notice the gray area around the image, wich is the original RelativeLayout BEFORE resizing, I think!

How can I remove that remaining space? Thanks!

Juan Cruz Soler
  • 8,172
  • 5
  • 41
  • 44

1 Answers1

0

Try this

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <ImageView
            android:id="@+id/imagen"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:scaleType="centerCrop"
            android:src="@drawable/image1"/>
</RelativeLayout>
ashishmohite
  • 1,120
  • 6
  • 14