I'm having trouble finding exactly the syntax I need to use to set the parameters in the child views of the relative layout. I have a root relative layout in which I want to set 2 child text images next to each other, e.g.
---------- ---------
| Second | | First |
---------- ---------
So, I have a
public class RL extends RelativeLayout{ public RL(context){ TextView first = new TextView(this); TextView second = new TextView(this); first.setText('First'); first.setId(1); second.setText('Second'); second.setId(2); addView(first, new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, LayoutParams.ALLIGN_PARENT_RIGHT ???); addView(first, new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, LayoutParams.ALLIGN_RIGHT_OF(first.getId()) ???); } }
How to set relative alignments?
source share