My layout is like this:
我的布局是这样的:
<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"
/>
.........
The distance between TableRows seems not so regular: some of them are too close and some of them are too far. I don't want to use android:paddingTop adjust them one by one.
桌布之间的距离似乎不太规律:有些太近了,有些太远了。我不想使用安卓系统:拨板将它们逐一调整。
is there any easy way to make same distance between them? Currently it looks like this:
有什么简单的方法可以让他们之间保持同样的距离吗?目前看起来是这样的:
2 个解决方案
#1
3
@giga_abhi is spot on, but I would add that in each TableRow, you also need:
@giga_abhi是spot on,但我要在每个TableRow中添加,您还需要:
android:layout_height="0dip"
and in the LinearLayout
:
和LinearLayout:
android:layout_height="fill_parent"
and in the ScrollView
:
在滚动视图:
android:fillViewport="true"
#2
1
In the LinearLayout
set:
LinearLayout设置:
android:weightSum="(no of tables say 3)"`
and in each TableRow
add this line:
在每个列表中加上这一行:
android:layout_weight="1"`
This will form TableRow with same height as your orientation is Vertical. The only part remains is adjusting height of elements inside TableRow.
这将形成与你的方向垂直的高度相同的TableRow。唯一剩下的部分就是调整TableRow内部元素的高度。
#1
3
@giga_abhi is spot on, but I would add that in each TableRow, you also need:
@giga_abhi是spot on,但我要在每个TableRow中添加,您还需要:
android:layout_height="0dip"
and in the LinearLayout
:
和LinearLayout:
android:layout_height="fill_parent"
and in the ScrollView
:
在滚动视图:
android:fillViewport="true"
#2
1
In the LinearLayout
set:
LinearLayout设置:
android:weightSum="(no of tables say 3)"`
and in each TableRow
add this line:
在每个列表中加上这一行:
android:layout_weight="1"`
This will form TableRow with same height as your orientation is Vertical. The only part remains is adjusting height of elements inside TableRow.
这将形成与你的方向垂直的高度相同的TableRow。唯一剩下的部分就是调整TableRow内部元素的高度。