Home >Java >javaTutorial >How to Set the Height and Width of an ImageView Programmatically?
Programmatic Setting of ImageView Dimensions
Q: How to assign the height and width of an ImageView programmatically?
A: To adjust the height of the ImageView:
imageView.getLayoutParams().height = 20;
Crucial Note: If altering the height after the layout has been established, it's essential to additionally invoke:
imageView.requestLayout();
The above is the detailed content of How to Set the Height and Width of an ImageView Programmatically?. For more information, please follow other related articles on the PHP Chinese website!