Reputation: 111
I'm pretty new to XML and Android Studio but shouldn't the attribute "wrap_content" wrap itself around the image? With this code the ImageView looks like this ImageView bigger than image
<ImageView
android:id="@+id/slika"
android:src="@drawable/kava"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:adjustViewBounds="false" />
And if I change the adjustViewBounds to "true" it looks good but messes everything up in portrait mode. Like this
Upvotes: 1
Views: 1078
Reputation: 111
What happens is if an image is larger than the screen the ImageView
will fit in it anyway and to do that it needs to add white spaces around it (if the image is mostly horizontal it will add the space above and below it).
To fit it in anyway and discard the white spaces, the only attribute I've found to work was android:adjustViewBounds="true"
Upvotes: 4