Java 复选框和文本视图与空白对齐

Java 复选框和文本视图与空白对齐,java,android,xml,Java,Android,Xml,我的XML布局有问题。如下图所示,文本视图位于复选框旁边(该复选框不包括任何android:text字段。如何删除我用蓝色下划线的空间 代码: 问题代码: <!-- BELOW THERE IS THE PROBLEMATICCODE --> <!-- BELOW THERE IS THE PROBLEMATICCODE --> <!-- BELOW THERE IS THE PROBLE

我的XML布局有问题。如下图所示,文本视图位于复选框旁边(该复选框不包括任何
android:text
字段。如何删除我用蓝色下划线的空间

代码:


问题代码:

            <!-- BELOW THERE IS THE PROBLEMATICCODE -->
            <!-- BELOW THERE IS THE PROBLEMATICCODE -->
            <!-- BELOW THERE IS THE PROBLEMATICCODE -->
            <!-- BELOW THERE IS THE PROBLEMATICCODE -->

            <TableRow
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="10dp"
                android:background="@drawable/ripetisfondo"
                android:padding="1dp" >

                <CheckBox
                    android:id="@+id/checkBox1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:background="#000000" />

                <TextView
                    android:id="@+id/textView1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:shadowColor="#000000"
                    android:shadowDx="1"
                    android:shadowDy="1"
                    android:shadowRadius="2"
                    android:text="@string/titolo1"
                    android:textColor="#FFFFFF"
                    android:textSize="15dp"
                    android:textStyle="bold" />
            </TableRow>
            <!-- TITOLO   TITOLO   TITOLO   TITOLO   TITOLO   TITOLO   TITOLO -->

代码的其余部分:

            <!-- TITOLO   TITOLO   TITOLO   TITOLO   TITOLO   TITOLO   TITOLO -->

            <TableRow
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="#33b5e5"
                android:padding="1dp" >
            </TableRow>

            <TableRow
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="#555555"
                android:padding="1dp" >

                <TextView
                    android:id="@+id/textView1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="10dp"
                    android:text="@string/impostazioni_5"
                    android:textSize="15dp"
                    android:textStyle="bold" />
            </TableRow>
            <!-- TITOLO   TITOLO   TITOLO   TITOLO   TITOLO   TITOLO   TITOLO -->

            <SeekBar
                android:id="@+id/sbNumeroPassate"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="10dp" />

            <LinearLayout>

                <TextView
                    android:id="@+id/tvMilliseconds"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:text="@string/impostazioni_1a" />

                <TextView
                    android:id="@+id/tvCurrentWaves"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:text="@string/impostazioni_current" />
            </LinearLayout>

            <LinearLayout>

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:text="@string/impostazioni_2a" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:text="@string/impostazioni_4a" />
            </LinearLayout>

            <!-- TITOLO   TITOLO   TITOLO   TITOLO   TITOLO   TITOLO   TITOLO -->

            <TableRow
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="#33b5e5"
                android:padding="1dp" >
            </TableRow>

            <TableRow
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="#555555"
                android:padding="1dp" >

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="10dp"
                    android:text="@string/impostazioni_6"
                    android:textSize="15dp"
                    android:textStyle="bold" />
            </TableRow>
            <!-- TITOLO   TITOLO   TITOLO   TITOLO   TITOLO   TITOLO   TITOLO -->

            <SeekBar
                android:id="@+id/sbMillisecTraPassate"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="10dp" />

            <LinearLayout>

                <TextView
                    android:id="@+id/tvMilliseconds"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:text="@string/impostazioni_1b" />

                <TextView
                    android:id="@+id/tvCurrentInterval"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:text="@string/impostazioni_current" />
            </LinearLayout>

            <LinearLayout>

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:text="@string/impostazioni_2b" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:text="@string/impostazioni_4b" />
            </LinearLayout>

            <!-- TITOLO   TITOLO   TITOLO   TITOLO   TITOLO   TITOLO   TITOLO -->

            <TableRow
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="#33b5e5"
                android:padding="1dp" >
            </TableRow>

            <TableRow
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="#555555"
                android:padding="1dp" >

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="10dp"
                    android:text="@string/impostazioni_7"
                    android:textSize="15dp"
                    android:textStyle="bold" />
            </TableRow>
            <!-- TITOLO   TITOLO   TITOLO   TITOLO   TITOLO   TITOLO   TITOLO -->

            <LinearLayout>

                <TextView
                    android:id="@+id/tvAccensioni"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:text="@string/statistica_1" />

                <TextView
                    android:id="@+id/tvSpegnimenti"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:text="@string/statistica_2" />
            </LinearLayout>

            <LinearLayout>

                <TextView
                    android:id="@+id/tvPotenzaUsata"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:text="@string/statistica_3" />

                <TextView
                    android:id="@+id/tvBottoneSalvato"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:text="@string/statistica_4" />
            </LinearLayout>

            <Button
                android:id="@+id/bSalva"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_marginTop="10dp"
                android:text="@string/impostazioni_salva" />
        </TableLayout>
    </ScrollView>

</LinearLayout>    

为什么不使用复选框的文本属性,而不是使用单独的文本视图来显示字符串

            <CheckBox
                android:id="@+id/checkBox1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="#000000"
                android:shadowColor="#000000"
                android:shadowDx="1"
                android:shadowDy="1"
                android:shadowRadius="2"
                android:text="@string/titolo1"
                android:textColor="#FFFFFF"
                android:textSize="15dp"
                android:textStyle="bold" />


你可以只粘贴单个复选框和单个文本视图xml代码吗?有问题的布局中有许多文本视图需要阅读,这是一幅图画。这里有4条注释,指出了确切的点删除不必要的一个有什么问题现在应该很容易找到它了…我跳过了整个代码,因为你通常会要求将整个代码提交给你了解问题
            <CheckBox
                android:id="@+id/checkBox1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="#000000"
                android:shadowColor="#000000"
                android:shadowDx="1"
                android:shadowDy="1"
                android:shadowRadius="2"
                android:text="@string/titolo1"
                android:textColor="#FFFFFF"
                android:textSize="15dp"
                android:textStyle="bold" />