Reputation: 110570
Can you please tell me how can I setHeight for a ViewGroup? I see there is a layout(l,t,r,b);
But that is different form setHeight(), since I don't know where should be the top/bottom of the viewGroup. I need to set the height of the ViewGroup and return that to ListAdapter.
Thank you.
Upvotes: 2
Views: 6840
Reputation: 49410
You can try using setLayoutParams()
myViewGroup.setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT));
See here the descriptions of the parameters to LayoutParams
public ViewGroup.LayoutParams (int width, int height)
Creates a new set of layout parameters with the specified width and height.
width the width, either MATCH_PARENT, WRAP_CONTENT or a fixed size in pixels
height the height, either MATCH_PARENT, WRAP_CONTENT or a fixed size in pixels
Upvotes: 6