2013-06-23 3 views
0

이것을 추가하면 RelativeLayouts에 프로그래밍 방식으로 추가 한 버튼이 레이아웃에 표시되지 않습니다. 하지만 부모를 채우기 위해 너비를 0에서 변경하면 오버랩됩니다. 각각의 RelativeLayout이 LinearLayout의 너비의 반을 차지하게하려면 어떻게해야합니까?부모 부모 너비에 중첩 된 RelativeLayouts?

<ScrollView 
    android:id="@+id/svButtons" 
    android:layout_width="match_parent" 
    android:layout_height="175dp" > 

    <LinearLayout 
    android:id="@+id/linlayColumns" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:orientation="vertical" 
    android:weightSum="2"> 

     <RelativeLayout 
     android:id="@+id/rellayLeftColumn" 
     android:layout_weight="1" 
     android:layout_width="0dp" 
     android:layout_height="wrap_content" > 
     </RelativeLayout> 

     <RelativeLayout 
     android:id="@+id/rellayRightColumn" 
     android:layout_weight="1" 
     android:layout_width="0dp" 
     android:layout_height="wrap_content" > 
     </RelativeLayout> 

    </LinearLayout> 

</ScrollView> 

답변

0

당신이 가로 RelativeLayouts을 분할 할 경우 은, 당신의 LinearLayout 방향이 horizontal로 설정해야합니다 :

<LinearLayout 
    android:id="@+id/linlayColumns" 
    android:orientation="horizontal" 
    ... > 
+0

가 아, 감사합니다, 즉 그것을 해결! 그런 간단한 간과 한 실수. –

관련 문제