1

I have a RelativeLayout with a number of children. The RelativeLayout is the main layout of my activity. I need to add to one of the children the layout value layout_alignParentBottom="true". I need to do this programmatically. the link How to set the android property layout_alignParentBottom to a button dynamically is not working for me because, basically, I don't want to have to inflate the RelativeLayout as I already have it at the setContentView(...). Any ideas how to do this?

Community
  • 1
  • 1
Cote Mounyo
  • 13,817
  • 23
  • 66
  • 87

1 Answers1

0

I figured it out:

RelativeLayout.LayoutParams layout = (LayoutParams) theChild.getLayoutParams();
layout.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
Cote Mounyo
  • 13,817
  • 23
  • 66
  • 87