praveenb praveenb - 4 months ago 19
Android Question

Set ImageView width and height programmatically?

How can I set an

ImageView
's width and height programmatically?

Answer

It may be too late but for the sake of others who have the same problem, to set the height of the ImageView:

image_view.getLayoutParams().height = 20;

Hope this helps.

Important. If you're setting the height after the layout has already been 'laid out', make sure you also call:

image_view.requestLayout()