我正在嘗試在一個表內部使一個ListView消耗掉所有可用的垂直空間減去EditText控件所需的空間。如何讓一個Android ListView在TableLayout中消耗剩餘空間
我已經設置每個屬性我能想到的在這裏,使其工作:
<?xml version="1.0" encoding="utf-8"?>
<TableRow android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FF0000">
<ScrollView android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ListView android:id="@+id/conversation"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:drawSelectorOnTop="false"/>
</ScrollView>
</TableRow>
<TableRow android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#00FF00">
<EditText android:id="@+id/messagetext"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="text|textAutoCorrect|textMultiLine|textImeMultiLine"
android:imeOptions="actionDone"/>
</TableRow>
我必須失去了一些東西,因爲結果是完全填充水平的,但ListView和EditText看起來好像其屬性是wrap_content一樣。
你的layout_weight不需要4的值。如果它是歸因於它的唯一元素,則可以將其賦值爲1. – 2010-10-22 17:37:28