首先,XML如下:困惑在TableLayout 「FILL_PARENT」
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TableLayout
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:stretchColumns = "1">
<TableRow>
<TextView
android:text = "Test Layout:"
android:id = "@+id/LayoutTextView01"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:textColor = "@color/red_bg" />
<EditText
android:text = ""
android:id = "@+id/EditText01"
android:layout_width = "fill_parent"
android:layout_height = "wrap_content" />
</TableRow>
<TableRow android:gravity = "right">
<Button
android:text = "test"
android:id = "@+id/layoutButton01"
android:layout_width = "fill_parent"
android:layout_height = "wrap_content" />
</TableRow>
</TableLayout>
</LinearLayout>
我的問題是:
1. fill_parent
手段填補其父容器的所有空間。而按鈕的父母應該有EditView中的父母相同的尺寸,併爲按鈕和EditView中兩集的android:layout_width爲「FILL_PARENT」,他們應該有相同的大小,就像這樣:
________ ___________________
|_______| |__________________|
__________________
|__________________|
但結果是這樣的:
________ ___________________
|_______| |__________________|
___________
|__________|
爲什麼?
感謝您的回答。 IOW android只會選擇屬於第0列的按鈕,因此按鈕的大小與TextView相同,對不對?順便說一句,在每個問題下面都有一個「添加評論」鏈接,您可以通過該鏈接添加評論。在每個問題的左側,都有一個五角星,你可以點擊它來收藏它。還有一個△▽,幫助你上下一個問題。 – Searene 2012-02-03 03:27:53
在每個問題和下面的答案下,都有一個「添加註釋」鏈接... – FallenAngel 2012-02-04 16:00:24