1

I was wondering if it's possible to align 2 siblings of different relative layouts with each other. for instance, given this XML:

<RelativeLayout>
  ..
  <RelativeLayout android:id="@+id/layout1" >
    ..
    <TextView android:id="@+id/text1 />
  </RelativeLayout>
  <RelativeLayout android:id="@+id/layout2" >
    ..
    <TextView android:id="@+id/text2 />
  </RelativeLayout>
</RelativeLayout>

I would like to align text1 and text2 with each other. is it possible? or alternately, is there some other way to achieve something like this? thanks!!

orenk86
  • 720
  • 9
  • 24
  • `I would like to align text1 and text2 with each other. is it possible?` **NO**. `alternately, is there some other way to achieve something like this?` **YES**: Align both TextViews to the parent's left and their parents to the grandparent's left. Better if both TextViews were in the same container. – Phantômaxx May 18 '14 at 12:22
  • ok great, thanks. I had a feeling it would be a problem, but just wanted to make sure. you're welcome to write down your comment as an answer so I can accept it :) – orenk86 May 18 '14 at 13:31
  • OK, done. Maybe it helps some one else too! ;) – Phantômaxx May 18 '14 at 13:44

1 Answers1

1

I would like to align text1 and text2 with each other. is it possible?
Simply said, NO, it's not.
Because the controls are in different ("parallel") containers, so they aren't visible to each other.

alternately, is there some other way to achieve something like this?
Luckily, YES there is:

Align both TextViews to the parent's left and their parents to the grandparent's left.

Although, it would have been better if both TextViews were in the same container.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115