praveenb praveenb - 1 year ago 95
Android Question

Set ImageView width and height programmatically?

How can I set an

ImageView
's width and height programmatically?

Answer Source

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()