Roger
Roger

Reputation: 4259

How to properly align form?

I have a form with a format of:

<LinearLayout>
    <RelativeLayout>TextView EditText Button</RelativeLayout>
    <RelativeLayout>TextView EditText Button</RelativeLayout>
    <RelativeLayout>TextView EditText Button</RelativeLayout>
    <RelativeLayout>TextView EditText Button</RelativeLayout>
</LinearLayout>

I have aligned the TextView to parentLeft, the Button to parentRight. And so far, the EditText to toLeftOf Button. Now, I want the EditText to all line up with the longest TextView, however I can't seem to use toRightOf of a TextView from a different layout. I'm not even sure that's the best way to do it.

What is the proper way to get everything to line up straight?

Upvotes: 0

Views: 567

Answers (2)

Tushar Vengurlekar
Tushar Vengurlekar

Reputation: 7679

You can try replacing the LinearLayout with RelativeLayoutand and remove the RelativeLayout for each row or use TableLayout as asahi suggested.

Upvotes: 0

Asahi
Asahi

Reputation: 13506

Consider using TableLayout instead

Upvotes: 2

Related Questions