ImageView shows white space above and below the image

I am adding an image to the android layout. There are no spaces in the image above and below, but when I add an image to the imageView, it shows a space at the top and bottom of the image. Therefore, if I want to add a text view immediately below the image space, appears between the image and the text.

I don’t understand why it imageviewshows a space above and below. I have not added anything like android:paddingetc.

  <ImageView
    android:id="@+id/imageView3"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true"
    android:src="@drawable/img1" />
+4
source share
2 answers

add these attributesto thisImageView

android:adjustViewBounds="true"
android:cropToPadding="false"
android:scaleType="fitXY"
+13
source

change to this

   <ImageView
   android:id="@+id/imageView3"
   android:layout_width="wrap_content"
   android:layout_height="match_parent"
   android:layout_alignParentLeft="true"
   android:layout_alignParentTop="true"
   android:adjustViewBounds="true"
   android:scaleType="fitXY"
   android:src="@drawable/img1" />
+4
source

All Articles