android:tablerow与列和多行文本混合

Yan*_*ang 5 android view tablelayout tablerow

我想让tablelayout包含几个tablerows.其中一行包含4个按钮,而第二行包含非常长的文本.但是,按钮的宽度会随着第二行中的文本而延伸.反正有没有阻止这个?

alt text http://i40.tinypic.com/34srli0.jpg alt text http://i44.tinypic.com/2505dmf.jpg

http://img684.imageshack.us/i/tableview1.jpg/

http://img521.imageshack.us/i/tableview2.jpg/

这是我的xml文件:(不知何故,这个网站对xml文件不友好)

AbsoluteLayout
android:id="@+id/widget0"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
>

TableLayout
android:id="@+id/widget28"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_x="0px"
android:layout_y="10px"
>

TableRow
android:id="@+id/widget29"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>

Button
android:id="@+id/widget30"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button"
>
</Button>

Button
android:id="@+id/widget31"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button"
>
</Button>

Button
android:id="@+id/widget32"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button"
>
</Button>

Button
android:id="@+id/widget33"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button"
>
</Button>
</TableRow>

TableRow
android:id="@+id/widget35"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>

TextView
android:id="@+id/widget40"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextViewTextViewTextViewTextViewTextViewTextView"
>
</TextView>
</TableRow>

</TableLayout>
</AbsoluteLayout>
Run Code Online (Sandbox Code Playgroud)

Ans*_*hul 3

尝试对 TextView 使用 android:layout_span="4"

将 4 替换为第一行中的列数(按钮)数。

另外,您可以从 Tablerow 中省略 android:layout_width 和 layout_height 参数