How do I remove extra space above and below imageView?

UKDataGeek picture UKDataGeek · Feb 28, 2013 · Viewed 40k times · Source

I have a really simple image within a RelativeLayout and for some reason I am getting extra spacing on the top and bottom which I can't remove. How can I clear it out?

Here is what it looks like:

Image from Eclipse preview

Here is the code:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
    <ImageView
            android:id="@+id/imageView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentTop="true"
            android:src="@drawable/slice11pp" />
</RelativeLayout>

Answer

Sagar V. picture Sagar V. · Mar 3, 2014

Try this

android:adjustViewBounds="true"