set height of imageview as matchparent programmatically

android, height, imageview

Solution

initiate LayoutParams .

assign the parent's width and height and pass it to setLayoutParams method of the imageview

Problem

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.

Original source