没有破解需要。:-) 只需将孩子的layout_width设置为wrap_content而不是fill_parent,或设置为固定值。将layout_gravity设置为center或center_horizontal。
编辑:添加代码。
试试这个:
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:shrinkColumns="*" android:stretchColumns="*">
<TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello"
android:gravity="center"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello"
android:gravity="center"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello"
android:gravity="center"
/>
</TableRow>
</TableLayout>
它似乎为我工作,查看详细的任何例子吗? – user718146 2011-05-31 14:01:22
它对我有用。 :-)我用代码更新了我的答案。 – DKIT 2011-06-01 08:45:11
感谢您的回复,我很抱歉,我仍然无法使用它,使用Button小部件而不是Textview :( – user718146 2011-06-01 11:16:32