0

I am developing an android app, where the entire UI is being developed in Java, since there's alot of dynamic stuff involved, like i might have to add buttons and checkboxes, depending on the user interaction. I want to know how to position 2 different views relative to one another? if i was using XML, i would've written like this:

<RelativeLayout ...
    <EditText android:id="@+id/text1" .... />
    <Button android:id="@+id/button1"
        android:layout_toRightOf="@id/text1" .... />
</RelativeLayout>

Now how do i do the same thing using Java?

Purav Shah
  • 523
  • 1
  • 4
  • 13

1 Answers1

1

This is similar: How to lay out Views in RelativeLayout programmatically?

And this looks exactly like your question: Setting parameters on child views of a RelativeLayout

Community
  • 1
  • 1
Peter Knego
  • 79,991
  • 11
  • 123
  • 154