I want to set the height of PercentRelativeLayout in percentage.
PercentRelativeLayout layout = new PercentRelativeLayout(this);
PercentRelativeLayout.LayoutParams llp = new PercentRelativeLayout.LayoutParams(PercentRelativeLayout.LayoutParams.MATCH_PARENT, 50%);
layout.setLayoutParams(llp);
myLayout.addView(layout);
I suppose to use percentHeight(50%) in LayoutParams, not Match_Parent or Wrap_Content.