我有一个包含两列的 TableLayout。左列中的文本和右列中的复选框。CheckBox 不会像我认为的那样响应重力。减去 15dp 填充后,它不会移到屏幕右侧。仍然有一些“填充”阻止它一直向右移动。
除此之外,这看起来就像我想要的一样。
这是最有效的方法吗?
以及如何推动 CheckBox?
![有趣][1]
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:background="#FFFFFF"
android:padding="15dp"
android:weightSum="100" >
<TableRow>
<TextView
android:id="@+id/textView1"
android:layout_weight="75"
android:text="Label textbox here"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#000000" />
<EditText
android:id="@+id/editText1"
android:layout_weight="25"
android:hint="0.00"
android:textColor="#000000" >
</EditText>
</TableRow>
<TableRow>
<TextView
android:id="@+id/textView1"
android:layout_weight="80"
android:text="Touch for option 2"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#000000" />
<CheckBox
android:id="@+id/checkBox1"
android:layout_weight="20"
android:textColor="#000000" />
</TableRow>
<TableRow>
<TextView
android:id="@+id/textView1"
android:layout_weight="80"
android:text="Touch for option 3"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#000000" />
<CheckBox
android:id="@+id/checkBox1"
android:layout_weight="20"
android:textColor="#000000" />
</TableRow>
<TableRow>
<TextView
android:id="@+id/textView1"
android:layout_weight="80"
android:text="Touch for option 4"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#000000" />
<CheckBox
android:id="@+id/checkBox1"
android:layout_weight="20"
android:textColor="#000000" />
</TableRow>
<TableRow>
<TextView
android:id="@+id/textView1"
android:layout_weight="80"
android:text="Touch for option 5"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#000000" />
<CheckBox
android:id="@+id/checkBox1"
android:layout_weight="20"
android:textColor="#000000" />
</TableRow>
<TableRow>
<TextView
android:id="@+id/textView1"
android:layout_weight="80"
android:text="Touch for option 6"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#000000" />
<CheckBox
android:id="@+id/checkBox1"
android:layout_weight="20"
android:textColor="#000000" />
</TableRow>
<TableRow>
<TextView
android:id="@+id/textView1"
android:layout_weight="80"
android:text="Touch for option 7"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#000000" />
<CheckBox
android:id="@+id/checkBox1"
android:layout_weight="20"
android:textColor="#000000" />
</TableRow>
<TableRow>
<TextView
android:id="@+id/textView1"
android:layout_weight="80"
android:text="Touch for option 8"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#000000" />
<CheckBox
android:id="@+id/checkBox1"
android:layout_weight="20"
android:textColor="#000000" />
</TableRow>
<TableRow>
<TextView
android:id="@+id/textView1"
android:layout_weight="80"
android:text="Touch for option 9"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#000000" />
<CheckBox
android:id="@+id/checkBox1"
android:layout_weight="20"
android:textColor="#000000" />
</TableRow>
</TableLayout>