首先,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