Question Detail

set imageview height and width programmatically android

5 years ago Views 1266 Visit Post Reply

How to set imageview height and width programmatically android


Thread Reply

Hemant Sharma

- 5 years ago

You have to call RequestLayout which is denai default set Height by XML file image_view.requestLayout();

this is the Simple way to set the height of the ImageView:

image_view.getLayoutParams().height =50;

Same with Width : 

image_view.getLayoutParams().width =50;