set height of imageview as matchparent programmatically

andro-girl picture andro-girl · Apr 25, 2012 · Viewed 109.2k times · Source

I need to set the height of an imageview as matchparent programatically.if it is a fixed height i know how to set.

but how can i set it as matchparent?

EDIT:

actually height of the parent layout is dynamic.so i need to make the height of the imageview as the height of parent.

Answer

C. Leung picture C. Leung · Apr 25, 2012
imageView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));