2014-03-02 2 views
2

아래 이미지와 같이 상대적 레이아웃을 그리는 데 여러 번 시도했습니다. 그러나 성공하지 못합니다. enter image description hereAndroid : Row.xml의 상대 레이아웃

페인트가있는 이미지를 디자인하여 조금 더 잘 설명합니다. 제안 사항이 있으십니까?

+0

을 당신은 또한 TableLayout을 사용할 수 있습니다 ...하지만 .. 첫 번째 행 4 차일을 가지고 있으며, 두 번째 행이 2childs이있는 중 2 개 행이있는 TableLayout을 복잡하다 이것을하고 적절하게 무게로 놀아 라. –

+0

나는 안드로이드를 처음 사용합니다. 최선을 다했지만 성공하지 못했습니다. 그게 내가 왜 질문을 게시했는지. –

+0

내가 제안한 레이아웃이 포함 된 답변을 게시했습니다. –

답변

2

보십시오이 (그것이 내가 내 댓글에 처음으로 제안 된 레이아웃의) :

<LinearLayout 
    xmlns 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" 
    > 
    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:layout_weight="1" 
     android:orientation="horizontal" 
     > 
     <TextView 
      android:layout_width="0dp" 
      android:layout_height="match_parent" 
      android:layout_weight="20" 
     /> 
     <TextView 
      android:layout_width="0dp" 
      android:layout_height="match_parent" 
      android:layout_weight="40" 
     /> 
     <TextView 
      android:layout_width="0dp" 
      android:layout_height="match_parent" 
      android:layout_weight="20" 
     /> 
     <TextView 
      android:layout_width="0dp" 
      android:layout_height="match_parent" 
      android:layout_weight="20" 
     /> 
    </LinearLayout> 
    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:layout_weight="1" 
     android:orientation="horizontal" 
     > 
     <TextView 
      android:layout_width="0dp" 
      android:layout_height="match_parent" 
      android:layout_weight="1" 
     /> 
     <TextView 
      android:layout_width="0dp" 
      android:layout_height="match_parent" 
      android:layout_weight="1" 
     /> 
    </LinearLayout> 
</LinearLayout> 

만들에 더 유용 (예 : 동적으로 내용을 할당 할) 안드로이드 (이 TextViews에게 약간의 ID를 제공, : ID를 = "@ + id/txtSomething").

이 객체는 TextViews : Buttons, ImageViews 대신 다른 컨트롤을 조합하여 사용할 수 있습니다.

+0

Thanks @artoo detoo. :) –

1

다음 생각하십시오 :

루트 - (수직) 선형 레이아웃이 차일

과를

첫 아이 - 선형 무게가 당신의 UI에 둘째 아이를 따라와 레이아웃 (수평) - 선형 레이아웃 (수평) 그것의 2 명의 childs를 위해 무게 1로.

0

당신이 3은 LinearLayouts 필요 것 같다 ...