0

I want to add a linerlayout at the bottom of relativelayout. How could I achieve that? This is the code snippet that I am using:

rl=new RelativeLayout(this);
ll = new LinearLayout(this);
buttons=new LinearLayout(this);

buttons.setOrientation(LinearLayout.HORIZONTAL);
ll.setOrientation(LinearLayout.VERTICAL);
//buttons.addRule();

LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
        LayoutParams.WRAP_CONTENT,
        LayoutParams.WRAP_CONTENT);
params.topMargin=450;
    //params.gravity = Gravity.BOTTOM;

rl.addView(ll);
rl.addView(buttons,params);
Cœur
  • 37,241
  • 25
  • 195
  • 267
Payal
  • 903
  • 1
  • 9
  • 28
  • refer to this answer it explains it well http://stackoverflow.com/questions/4638832/how-to-programmatically-set-the-layout-align-parent-right-attribute-of-a-button – Coderji Nov 10 '13 at 11:37

1 Answers1

0

I think something like this, should work :

rl=new RelativeLayout(this);
buttons=new LinearLayout(this);

buttons.setOrientation(LinearLayout.HORIZONTAL);

RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
lp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);

rl.addView(buttons, lp);
Allan
  • 301
  • 1
  • 7