【发布时间】:2010-10-31 12:00:18
【问题描述】:
我开始学习 android 并且正在制作一个简单的游戏。在这个游戏中,我需要两个宽度相同的滚动列表,所以我在两个视图中都将 layout_weight 参数设置为“1”。但是当我运行程序时,滚动视图有不同的大小。第二个问题是我需要将 EditText 小部件设置得很低,所以我对 TableRows 做了同样的事情,但最后我必须将 weight 设置为 0.1 以达到所需的大小。
附:如果有错误,对不起我的英语
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/widget28"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TableRow
android:id="@+id/widget29"
android:layout_width="fill_parent"
android:layout_weight="7"
android:orientation="vertical" >
<ScrollView
android:id="@+id/widget34"
android:layout_height="150px"
android:layout_weight="1"
android:background="#ffff00ff" >
</ScrollView>
<ScrollView
android:id="@+id/widget35"
android:layout_height="150px"
android:layout_weight="1"
android:background="#ff00ffff" >
</ScrollView>
</TableRow>
<TableRow
android:id="@+id/widget30"
android:layout_width="fill_parent"
android:layout_weight="0.1"
android:orientation="vertical" >
<EditText
android:id="@+id/widget36"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="Not editable"
android:textSize="18sp" >
</EditText>
</TableRow>
</TableLayout>
【问题讨论】: