2013-07-11 3 views
1

내 레이아웃은 다음과 같이이다 :레이아웃에 동일한 높이의 TableRow를 만들려면 어떻게해야합니까?

<ScrollView 
     android:id="@+id/scrollView_page1" 
     android:layout_width="300dp" 
     android:layout_height="700dp" > 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:orientation="vertical" > 

      <TableRow 
       android:layout_width="fill_parent" 
       android:layout_height="60dip" 
       android:gravity="right" 
        > 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="@string/string1" 
       android:id="@+id/textview1"/> 
      <EditText 
       android:id="@+id/edittext1" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:width="200dp" 
       android:inputType="number"/> 
      </TableRow> 

      <TableRow 
       android:layout_width="fill_parent" 
       android:layout_height="60dip" 
       android:gravity="right" 

       > 
       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="@string/string2" 
        android:id="@+id/textview2"/> 

      <Spinner 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:id="@+id/spinner1" 
        android:width="200dp" 
        /> 
       ......... 

TableRows 사이의 거리가 너무 정기적으로하지 보인다 : 그들 중 일부는 너무 가까이와 그들 중 일부는 너무 멀리 있습니다. 안드로이드를 사용하고 싶지 않습니다. paddingTop을 하나씩 조정하십시오.

그들 사이의 동일한 거리를 쉽게 만들 수있는 방법은 무엇입니까? 현재는 다음과 같습니다

LinearLayout 세트에서

Picture of layout as it is now with varying row heights

+0

이것은 내 레이아웃 그림 -> [http://imm.io/1bWnk] (http://imm.io/1bWnk) –

답변

3

@giga_abhi가 발견,하지만 난 각 TableRow에서 그를 추가, 당신은 또한 필요

android:layout_height="0dip" 

LinearLayout의 :

android:layout_height="fill_parent" 

ScrollView의 :

android:fillViewport="true" 
+0

입니다. 이 문제에 대한 아이디어? : http://stackoverflow.com/questions/23087668/how-do-i-wrap-a-second-text-around-first-text-title-both-are-in-text-view –

+0

@ JusticeBauer 가야 겠지만, 정확히는 우아하지 않습니다! –

1

:

android:weightSum="(no of tables say 3)"` 

TableRow에서

이 줄을 추가 :

android:layout_weight="1"` 

이 같은 높이로와 TableRow 형성한다 귀하의 방향은 수직입니다. 유일한 부분은 TableRow 내부의 요소 높이를 조정하는 것입니다.

관련 문제