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.
You can use the MATCH_PARENT constant or its numeric value -1.
initiate LayoutParams .
assign the parent's width and height and pass it to setLayoutParams method of the imageview
I had same issue. Resolved by firstly setting :
And then :
setMinHeight is defined by ImageView, while setMinimumHeight is defined by View. According to the docs, the greater of the two values is used, so both must be set.
You can try this incase you would like to match parent. The dimensions arrangement is width and height inorder