T
T
TimkaTV2015-05-09 14:32:20
Android
TimkaTV, 2015-05-09 14:32:20

How to dynamically resize an ImageView?

Good afternoon, I have a ListView with Pictures as elements.
I would like the image to stretch across the width of the screen (this can be done), and scaled in length automatically. Tried fill_parent + CenterCrop doesn't work very well.
There are also elements consisting of TextView, when scrolling text and image elements, the value of the slider changes. Is it possible to make it permanent? Thanks a lot!!!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
abukhvalov, 2015-05-10
@abukhvalov

If I understand correctly, then approximately:
Bitmap tmpBitmap = (Bitmap) your picture;
Bitmap resizedBitmap = Bitmap.createScaledBitmap(tmpBitmap, newWidth, newHeight, false);
Width and height will have to be calculated in advance, of course.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question