First, xml is as follows:
<?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>
My question is:
1.fill_parent means fill all the spaces of its parent container. And the parent of Button should have the same size of the parent of EditView, and for Button and EditView both set android:layout_width to “fill_parent”, they should have the same size, just like that:
________ ___________________
|_______| |__________________|
__________________
|__________________|
But the result is like that:
________ ___________________
|_______| |__________________|
___________
|__________|
why?
Maybe it helps if you add
android:layout_column="1"to yourbutton tag.By the way. How can i commend questions instead of submitting an answer?