Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I specify layout_below programmatically for a LinearLayout?

I want to do something like this programmatically -

<RelativeLayout1>
  <LinearLayout name = 1>
  <LinearLayout below = 1>
<RelativeLayout1>

I try to do this:

LinearLayout.LayoutParams params = (LinearLayout.LayoutParams)mButtonContainer.getLayoutParams();

params have weight field, width field, but does not have layout_below... Thanks for any help!

like image 857
ADK Avatar asked Apr 19 '26 16:04

ADK


1 Answers

with addRule

RelativeLayout.LayoutParams relativeParams = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
relativeParams.addRule(RelativeLayout.BELOW, idOfTheViewBelow);
like image 164
Blackbelt Avatar answered Apr 22 '26 00:04

Blackbelt



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!