Resize ImageView container to exactly match an image that gets placed inside of it

380
January 14, 2017, at 2:49 PM

I have an ImageView that is set to a width of match_parent, a height of wrap_content and a scaletype of centerInside. I then, in the code, place a horizontal rectangular bitmap inside of it and the bitmap fills the width correctly. The imageview container, however, is a square so it extends past the bounds of the bitmap in the vertical direction. How can I resize the imageview so that it exactly matches the size of the bitmap?

Answer 1

Use adjustViewBounds="true" in the ImageView to make it fit to size of the contained image.

Rent Charter Buses Company
READ ALSO
Spotify SDK mysteriously fails to play certain songs

Spotify SDK mysteriously fails to play certain songs

I have been trying to create a music app built around the Spotify Android SDK

326
Android: Send email with a data attachment without the file access madness

Android: Send email with a data attachment without the file access madness

I'm writing a library that, as part of its function, sends data as an attachment over email

380
cannot read bytes from file with go after writing

cannot read bytes from file with go after writing

So, i am trying to make a simple AOT virtual machine in golang, that reads a bytecode file as it's inputI am trying to very basically, write bytes to a file then read them with ioutil, however I am encountering a null dereference error

430
Mongo won't allow me to backup my databases

Mongo won't allow me to backup my databases

I have a new pc and am trying to migrate over my mongodbs

429