Set ImageView width and height programmatically?

To set ImageView width and height programmatically

image_view.getLayoutParams().height = 20;

Important. If you’re setting the height after the layout has already been ‘laid out’, make sure you call image_view.requestLayout()

Here is the ref link, credits to Hakem Zaied

Hope this helps.

Leave a Reply

Your email address will not be published. Required fields are marked *