Reputation: 8768
My main (highest in hierarchy) layout is a RelativeLayout
. Within it, I am programmatically creating a LinearLayout
. It must have the attribute of being "below" button1
. I know how to use addRule()
to add this to RelativeLayout.LayoutParams
, but LinearLayout.LayoutParams
doesn't have that option.
Upvotes: 0
Views: 494
Reputation: 152867
Your LinearLayout
is a child to its RelativeLayout
parent. LayoutParams
specify the child's layout within its parent, so in this case the correct LayoutParams
to use for a RelativeLayout
parent is RelativeLayout.LayoutParams
.
Upvotes: 1
Reputation: 894
You can not have below property to LinearLayout. At max you can give orientation type of Vertical or Horizontal. e.g.
LinearLayout layout = /* ... */;
layout.setOrientation(LinearLayout.VERTICAL);
//OR
layout.setOrientation(LinearLayout.HORIZONTAL);
Upvotes: 2