如何设置的ImageView
的宽度和高度编程?
How can I set an ImageView
's width and height programmatically?
这可能为时已晚,但为他人着想谁拥有了同样的问题,要设置的ImageView的高度:
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()