0

I am using ImageView to show picture. However, for some pictures, the boundary of ImageView is bigger than the picture although i have set it as wrap_content. For example,

enter image description here

Here is my xml.

<ImageView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/imageView"
    android:src="@drawable/image_16"
    android:layout_centerInParent="true" />

How can i make sure the boundary is same size as the image?

Sam
  • 1,252
  • 5
  • 20
  • 43

1 Answers1

0

add this to your ImageView xml tag

   android:scaleType="centerCrop"

this will make sure that the image takes it's size without stretching

asim13se
  • 11
  • 3