patternjavaCritical
Set ImageView width and height programmatically?
Viewed 0 times
imageviewandwidthsetheightprogrammatically
Problem
How can I set an
ImageView's width and height programmatically?Solution
It may be too late but for the sake of others who have the same problem, to set the height of the
Important. If you're setting the height after the layout has already been 'laid out', make sure you also call:
ImageView:imageView.getLayoutParams().height = 20;Important. If you're setting the height after the layout has already been 'laid out', make sure you also call:
imageView.requestLayout();Code Snippets
imageView.getLayoutParams().height = 20;imageView.requestLayout();Context
Stack Overflow Q#3144940, score: 1261
Revisions (0)
No revisions yet.