2013-05-21 2 views
1

RelativeLayouts 두 가지로 배치 된 토우베이스 라인을 TextViews에 정렬하려고합니다.서로 다른 두 레이아웃의 텍스트 뷰 정렬 기준선

 <RelativeLayout 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:gravity="right"> 

      <TextView 
       android:id="@+id/tv_city_a" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="City"/> 

     </RelativeLayout> 

     <RelativeLayout 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content"> 

      <TextView 
       android:id="@+id/tv_city_b" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:layout_alignBottom="@id/tv_city" 
       android:background="@drawable/txt_field_white"/> 

     </RelativeLayout> 

내가 tv_city_btv_city_a의 기준선을 정렬 할하지만 위의 코드가 작동하지 않습니다 : 다음은 내가 사용하고있는 코드입니다.

참고 : 인해이 나는 S '의 두 개의 서로 다른 RelativeLayout에서의'상기 TextView을 배치해야, 요구 사항을 설계합니다. 나는 그들을 하나에 넣을 수 없다. enter image description here

+0

수 출력 또는 전체 레이아웃 게시 –

+0

패딩 제거 위쪽. – Anukool

+0

당신은 어떤 선형 레이아웃에 두 상대적 레이아웃을 배치 할 수 있습니다 –

답변

0

당신은 다른 부모와 전망에 대한 기준을 링크 할 수 없습니다 :

편집 다음

내가 무엇입니까 출력입니다. 유일한 옵션은 1 RelativeLayout에서 그들과 합류하거나 등 등

편집 올바른 패딩, 마진, 부모 정렬을 제공하여 정렬하는 것입니다 : 두 번째 RelativeLayout의에서 android:paddingTop="5dp"을 가지고 있기 때문에 잘못된 출력이오고

+0

그래서 내가 뭘하려고하는지 달성 할 수 없습니다. 다른 방법이 있습니까? –

+0

@VinodMaurya 당신은 TextView A의 배치를 측정하고 그에 따라 TextView B를 배치하려고 할 수 있습니다 ... – Warpzit

관련 문제