我想要做的是从TableLayout
中删除每个填充和边距,并显示儿童按钮平铺。Android TableLayout删除填充
这是activity_main.xml
代码
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".Main"
android:orientation="horizontal"
android:baselineAligned="false">
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/button1" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/button4" />
</TableRow>
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/button2" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/button3" />
</TableRow>
</TableLayout>
所有的补白设置为0
这就是我得到:
这是我什么试图得到:
您使用FILL_PARENT你应该是您使用的API使用WRAP_CONTENT – geekCode 2014-09-02 22:58:37
? – 2014-09-02 23:03:11
您是对的,但是我使用API级别14 – bukk530 2014-09-02 23:53:03