java复选框和文本视图与空白对齐
我的XML布局有问题。如下图所示,文本视图位于复选框(不包括任何安卓:text
字段)旁边。如何删除我用蓝色下划线的空格
代码:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:安卓="http://schemas.安卓.com/apk/res/安卓"
安卓:layout_width="fill_parent"
安卓:layout_height="fill_parent"
安卓:orientation="vertical" >
<Button
安卓:id="@+id/bDisinstalla"
安卓:layout_width="match_parent"
安卓:layout_height="wrap_content"
安卓:layout_gravity="center"
安卓:layout_marginTop="5dp"
安卓:text="@string/disinstalla"
安卓:textColor="#FF0000"
安卓:textSize="26dp" />
<ScrollView
安卓:id="@+id/scrollView1"
安卓:layout_width="match_parent"
安卓:layout_height="wrap_content"
安卓:fadeScrollbars="true" >
<TableLayout
安卓:id="@+id/tableLayout1"
安卓:layout_width="match_parent"
安卓:layout_height="wrap_content" >
<CheckBox
安卓:id="@+id/cbAbilitaServizio"
安卓:layout_width="wrap_content"
安卓:layout_height="wrap_content"
安卓:text="@string/abilita_servizio" >
</CheckBox>
<CheckBox
安卓:id="@+id/cbSpegniSchermo"
安卓:layout_width="wrap_content"
安卓:layout_height="wrap_content"
安卓:text="@string/spegni_schermo" >
</CheckBox>
<CheckBox
安卓:id="@+id/cbLandscape"
安卓:layout_width="wrap_content"
安卓:layout_height="wrap_content"
安卓:text="@string/landscape" >
</CheckBox>
<Button
安卓:id="@+id/bCalibrazione"
安卓:layout_width="match_parent"
安卓:layout_height="wrap_content"
安卓:layout_gravity="center"
安卓:text="@string/calibrazione" />
问题代码:
<!-- BELOW THERE IS THE PROBLEMATICCODE -->
<!-- BELOW THERE IS THE PROBLEMATICCODE -->
<!-- BELOW THERE IS THE PROBLEMATICCODE -->
<!-- BELOW THERE IS THE PROBLEMATICCODE -->
<TableRow
安卓:layout_width="match_parent"
安卓:layout_height="wrap_content"
安卓:layout_marginTop="10dp"
安卓:background="@drawable/ripetisfondo"
安卓:padding="1dp" >
<CheckBox
安卓:id="@+id/checkBox1"
安卓:layout_width="wrap_content"
安卓:layout_height="wrap_content"
安卓:background="#000000" />
<TextView
安卓:id="@+id/textView1"
安卓:layout_width="wrap_content"
安卓:layout_height="wrap_content"
安卓:shadowColor="#000000"
安卓:shadowDx="1"
安卓:shadowDy="1"
安卓:shadowRadius="2"
安卓:text="@string/titolo1"
安卓:textColor="#FFFFFF"
安卓:textSize="15dp"
安卓:textStyle="bold" />
</TableRow>
<!-- TITOLO TITOLO TITOLO TITOLO TITOLO TITOLO TITOLO -->
其余代码:
<!-- TITOLO TITOLO TITOLO TITOLO TITOLO TITOLO TITOLO -->
<TableRow
安卓:layout_width="wrap_content"
安卓:layout_height="wrap_content"
安卓:background="#33b5e5"
安卓:padding="1dp" >
</TableRow>
<TableRow
安卓:layout_width="wrap_content"
安卓:layout_height="wrap_content"
安卓:background="#555555"
安卓:padding="1dp" >
<TextView
安卓:id="@+id/textView1"
安卓:layout_width="wrap_content"
安卓:layout_height="wrap_content"
安卓:layout_marginLeft="10dp"
安卓:text="@string/impostazioni_5"
安卓:textSize="15dp"
安卓:textStyle="bold" />
</TableRow>
<!-- TITOLO TITOLO TITOLO TITOLO TITOLO TITOLO TITOLO -->
<SeekBar
安卓:id="@+id/sbNumeroPassate"
安卓:layout_width="match_parent"
安卓:layout_height="wrap_content"
安卓:layout_marginLeft="10dp"
安卓:layout_marginRight="10dp" />
<LinearLayout>
<TextView
安卓:id="@+id/tvMilliseconds"
安卓:layout_width="wrap_content"
安卓:layout_height="wrap_content"
安卓:layout_marginLeft="10dp"
安卓:layout_marginRight="10dp"
安卓:text="@string/impostazioni_1a" />
<TextView
安卓:id="@+id/tvCurrentWaves"
安卓:layout_width="wrap_content"
安卓:layout_height="wrap_content"
安卓:layout_marginLeft="10dp"
安卓:layout_marginRight="10dp"
安卓:text="@string/impostazioni_current" />
</LinearLayout>
<LinearLayout>
<TextView
安卓:layout_width="wrap_content"
安卓:layout_height="wrap_content"
安卓:layout_marginLeft="10dp"
安卓:layout_marginRight="10dp"
安卓:text="@string/impostazioni_2a" />
<TextView
安卓:layout_width="wrap_content"
安卓:layout_height="wrap_content"
安卓:layout_marginLeft="10dp"
安卓:layout_marginRight="10dp"
安卓:text="@string/impostazioni_4a" />
</LinearLayout>
<!-- TITOLO TITOLO TITOLO TITOLO TITOLO TITOLO TITOLO -->
<TableRow
安卓:layout_width="wrap_content"
安卓:layout_height="wrap_content"
安卓:background="#33b5e5"
安卓:padding="1dp" >
</TableRow>
<TableRow
安卓:layout_width="wrap_content"
安卓:layout_height="wrap_content"
安卓:background="#555555"
安卓:padding="1dp" >
<TextView
安卓:layout_width="wrap_content"
安卓:layout_height="wrap_content"
安卓:layout_marginLeft="10dp"
安卓:text="@string/impostazioni_6"
安卓:textSize="15dp"
安卓:textStyle="bold" />
</TableRow>
<!-- TITOLO TITOLO TITOLO TITOLO TITOLO TITOLO TITOLO -->
<SeekBar
安卓:id="@+id/sbMillisecTraPassate"
安卓:layout_width="match_parent"
安卓:layout_height="wrap_content"
安卓:layout_marginLeft="10dp"
安卓:layout_marginRight="10dp" />
<LinearLayout>
<TextView
安卓:id="@+id/tvMilliseconds"
安卓:layout_width="wrap_content"
安卓:layout_height="wrap_content"
安卓:layout_marginLeft="10dp"
安卓:layout_marginRight="10dp"
安卓:text="@string/impostazioni_1b" />
<TextView
安卓:id="@+id/tvCurrentInterval"
安卓:layout_width="wrap_content"
安卓:layout_height="wrap_content"
安卓:layout_marginLeft="10dp"
安卓:layout_marginRight="10dp"
安卓:text="@string/impostazioni_current" />
</LinearLayout>
<LinearLayout>
<TextView
安卓:layout_width="wrap_content"
安卓:layout_height="wrap_content"
安卓:layout_marginLeft="10dp"
安卓:layout_marginRight="10dp"
安卓:text="@string/impostazioni_2b" />
<TextView
安卓:layout_width="wrap_content"
安卓:layout_height="wrap_content"
安卓:layout_marginLeft="10dp"
安卓:layout_marginRight="10dp"
安卓:text="@string/impostazioni_4b" />
</LinearLayout>
<!-- TITOLO TITOLO TITOLO TITOLO TITOLO TITOLO TITOLO -->
<TableRow
安卓:layout_width="wrap_content"
安卓:layout_height="wrap_content"
安卓:background="#33b5e5"
安卓:padding="1dp" >
</TableRow>
<TableRow
安卓:layout_width="wrap_content"
安卓:layout_height="wrap_content"
安卓:background="#555555"
安卓:padding="1dp" >
<TextView
安卓:layout_width="wrap_content"
安卓:layout_height="wrap_content"
安卓:layout_marginLeft="10dp"
安卓:text="@string/impostazioni_7"
安卓:textSize="15dp"
安卓:textStyle="bold" />
</TableRow>
<!-- TITOLO TITOLO TITOLO TITOLO TITOLO TITOLO TITOLO -->
<LinearLayout>
<TextView
安卓:id="@+id/tvAccensioni"
安卓:layout_width="wrap_content"
安卓:layout_height="wrap_content"
安卓:layout_marginLeft="10dp"
安卓:layout_marginRight="10dp"
安卓:text="@string/statistica_1" />
<TextView
安卓:id="@+id/tvSpegnimenti"
安卓:layout_width="wrap_content"
安卓:layout_height="wrap_content"
安卓:layout_marginLeft="10dp"
安卓:layout_marginRight="10dp"
安卓:text="@string/statistica_2" />
</LinearLayout>
<LinearLayout>
<TextView
安卓:id="@+id/tvPotenzaUsata"
安卓:layout_width="wrap_content"
安卓:layout_height="wrap_content"
安卓:layout_marginLeft="10dp"
安卓:layout_marginRight="10dp"
安卓:text="@string/statistica_3" />
<TextView
安卓:id="@+id/tvBottoneSalvato"
安卓:layout_width="wrap_content"
安卓:layout_height="wrap_content"
安卓:layout_marginLeft="10dp"
安卓:layout_marginRight="10dp"
安卓:text="@string/statistica_4" />
</LinearLayout>
<Button
安卓:id="@+id/bSalva"
安卓:layout_width="match_parent"
安卓:layout_height="wrap_content"
安卓:layout_gravity="center"
安卓:layout_marginTop="10dp"
安卓:text="@string/impostazioni_salva" />
</TableLayout>
</ScrollView>
</LinearLayout>
# 1 楼答案
与其使用单独的文本视图来显示字符串,为什么不使用Checkbox的文本属性呢