Android复选框不显示

时间:2013-05-30 20:20:04

标签: android tablet galaxy-tab nexus-7

我正在开发的应用程序有一些复选框。每当我在Nexus 7上试用它时,它都能完美运行。但是,当我在Galaxy Tab 2 7.0上试用时,复选框不显示。

在Nexus 7中:http://tinypic.com/view.php?pic=2wokitu&s=5

在Galaxy标签中:http://tinypic.com/view.php?pic=2z4he13&s=5

我一直试图理解这一点,但实际上我无法弄清楚为什么它会在Nexus上运行,而不是在Tab上运行。任何见解将不胜感激。是的,不幸的是我必须使用Tab。

编辑:对不起我昨天发布的时候离开了,我有点匆忙做了。这是代码:

<?xml version="1.0" encoding="utf-8"?>
    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
     android:id="@+id/android:list"
     android:layout_width="fill_parent"
     android:layout_height="wrap_content"
     android:background="#777777" >

        <RelativeLayout
            android:id="@+id/KernelInspectionLayout"
            android:layout_width="match_parent"
            android:layout_height="1186dp"
            android:orientation="horizontal" >

            <TableLayout 
                android:id="@+id/tableLayout1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/txtTitle"
                android:layout_marginLeft="70dp"
                android:layout_marginTop="50dp"
                android:background="#000000" >
                <TableRow
                    android:id="@+id/Header1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >

                    <TextView
                        android:id="@+id/txtProblema"
                        android:layout_margin="2dp"
                        android:gravity="center"
                        android:background="#FFF000"
                        android:textColor="#000000"
                        android:text="Problema"
                        android:layout_span="2"
                        android:textAppearance="?android:attr/textAppearanceMedium"
                        android:textSize="30dp" />

                    <TextView
                        android:id="@+id/txtAbreviatura"
                        android:layout_margin="2dp"
                        android:gravity="center"
                        android:background="#FFF000"
                        android:textColor="#000000"
                        android:text="Abreviatura"
                        android:textAppearance="?android:attr/textAppearanceMedium"
                        android:textSize="30dp" />
                </TableRow>

                <TableRow
                    android:id="@+id/tableRow11"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >

                    <CheckBox
                        android:id="@+id/chkOK"
                        android:layout_margin="2dp"
                        android:background="#FFFFFF"
                        android:tag="OK"
                        android:textSize="30dp" />

                    <TextView
                        android:id="@+id/txtOK"
                        android:layout_margin="2dp"
                        android:background="@color/table_bg_colors"
                        android:gravity="center"
                        android:text="Good Ear"
                        android:textAppearance="?android:attr/textAppearanceMedium"
                        android:textColor="#FF0000"
                        android:textSize="30dp" />

                    <TextView
                        android:id="@+id/txtOKA"
                        android:layout_margin="2dp"
                        android:gravity="center"
                        android:text="OK"
                        android:textAppearance="?android:attr/textAppearanceMedium"
                        android:textColor="@color/abrv_bg_colors"
                        android:textSize="30dp" />
                </TableRow>

                <TableRow
                    android:id="@+id/tableRow1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >

                    <CheckBox
                        android:id="@+id/chkWorms"
                        android:layout_margin="2dp"
                        android:background="#FFFFFF"
                        android:tag="Gusano"
                        android:textSize="30dp" />

                    <TextView
                        android:id="@+id/txtWorms"
                        android:layout_margin="2dp"
                        android:background="@color/table_bg_colors"
                        android:gravity="center"
                        android:text="Gusano"
                        android:textAppearance="?android:attr/textAppearanceMedium"
                        android:textColor="#FF0000"
                        android:textSize="30dp" />

                    <TextView
                        android:id="@+id/txtGU"
                        android:layout_margin="2dp"
                        android:gravity="center"
                        android:text="GU"
                        android:textAppearance="?android:attr/textAppearanceMedium"
                        android:textColor="@color/abrv_bg_colors"
                        android:textSize="30dp" />
                </TableRow>

                <TableRow
                    android:id="@+id/tableRow2"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >

                    <CheckBox
                        android:id="@+id/chkCSBAdult"
                        android:layout_margin="2dp"
                        android:background="#FFFFFF"
                        android:tag="CSB - Adult"
                        android:textSize="30dp" />

                    <TextView
                        android:id="@+id/txtCSBAdult"
                        android:layout_margin="2dp"
                        android:background="@color/table_bg_colors"
                        android:gravity="center"
                        android:text="CSB-Adulto"
                        android:textAppearance="?android:attr/textAppearanceMedium"
                        android:textColor="#FF0000"
                        android:textSize="30dp" />

                    <TextView
                        android:id="@+id/txtCSBA"
                        android:layout_margin="2dp"
                        android:gravity="center"
                        android:text="CSB-A"
                        android:textAppearance="?android:attr/textAppearanceMedium"
                        android:textColor="@color/abrv_bg_colors"
                        android:textSize="30dp" />
                </TableRow>

                <TableRow
                    android:id="@+id/tableRow3"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >

                    <CheckBox
                        android:id="@+id/chkCSBLarva"
                        android:tag="CSB - Larva"
                        android:layout_margin="2dp"
                        android:background="#FFFFFF"
                        android:textSize="30dp" />

                    <TextView
                        android:id="@+id/txtCSBLarva"
                        android:layout_margin="2dp"
                        android:background="@color/table_bg_colors"
                        android:gravity="center"
                        android:text="CSB-Larva"
                        android:textAppearance="?android:attr/textAppearanceMedium"
                        android:textColor="#FF0000"
                        android:textSize="30dp" />

                    <TextView
                        android:id="@+id/txtCSBL"
                        android:layout_margin="2dp"
                        android:gravity="center"
                        android:text="CSB-L"
                        android:textAppearance="?android:attr/textAppearanceMedium"
                        android:textColor="@color/abrv_bg_colors"
                        android:textSize="30dp" />
                </TableRow>

                <TableRow
                    android:id="@+id/tableRow4"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >

                    <CheckBox
                        android:id="@+id/chkCSFLarva"
                        android:tag="CSF - Larva"
                        android:layout_margin="2dp"
                        android:background="#FFFFFF"
                        android:textSize="30dp" />

                    <TextView
                        android:id="@+id/txtCSFLarva"
                        android:layout_margin="2dp"
                        android:background="@color/table_bg_colors"
                        android:gravity="center"
                        android:text="CSF-Larva"
                        android:textAppearance="?android:attr/textAppearanceMedium"
                        android:textColor="#FF0000"
                        android:textSize="30dp" />

                    <TextView
                        android:id="@+id/txtCSFL"
                        android:layout_margin="2dp"
                        android:gravity="center"
                        android:text="CSF-L"
                        android:textAppearance="?android:attr/textAppearanceMedium"
                        android:textColor="@color/abrv_bg_colors"
                        android:textSize="30dp" />
                </TableRow>

                <TableRow
                    android:id="@+id/tableRow5"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >

                    <CheckBox
                        android:id="@+id/chkAves"
                        android:layout_margin="2dp"
                        android:background="#FFFFFF"
                        android:tag="Aves"
                        android:textSize="30dp" />

                    <TextView
                        android:id="@+id/txtAves"
                        android:layout_margin="2dp"
                        android:background="@color/table_bg_colors"
                        android:gravity="center"
                        android:text="Aves"
                        android:textAppearance="?android:attr/textAppearanceMedium"
                        android:textColor="#FF0000"
                        android:textSize="30dp" />

                    <TextView
                        android:id="@+id/txtAve"
                        android:layout_margin="2dp"
                        android:gravity="center"
                        android:text="Ave"
                        android:textAppearance="?android:attr/textAppearanceMedium"
                        android:textColor="@color/abrv_bg_colors"
                        android:textSize="30dp" />
                </TableRow>

                <TableRow
                    android:id="@+id/tableRow6"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >

                    <CheckBox
                        android:id="@+id/chkThrips"
                        android:layout_margin="2dp"
                        android:background="#FFFFFF"
                        android:tag="Thrips"
                        android:textSize="30dp" />

                    <TextView
                        android:id="@+id/txtThrips"
                        android:layout_margin="2dp"
                        android:background="@color/table_bg_colors"
                        android:gravity="center"
                        android:text="Thrips"
                        android:textAppearance="?android:attr/textAppearanceMedium"
                        android:textColor="#FF0000"
                        android:textSize="30dp" />

                    <TextView
                        android:id="@+id/txtTH"
                        android:layout_margin="2dp"
                        android:gravity="center"
                        android:text="TH"
                        android:textAppearance="?android:attr/textAppearanceMedium"
                        android:textColor="@color/abrv_bg_colors"
                        android:textSize="30dp" />
                </TableRow>

                <TableRow
                    android:id="@+id/tableRow7"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >

                    <CheckBox
                        android:id="@+id/chkHongo"
                        android:layout_margin="2dp"
                        android:background="#FFFFFF"
                        android:tag="Hongo"
                        android:textSize="30dp" />

                    <TextView
                        android:id="@+id/txtHongo"
                        android:layout_margin="2dp"
                        android:background="@color/table_bg_colors"
                        android:gravity="center"
                        android:text="Hongo"
                        android:textAppearance="?android:attr/textAppearanceMedium"
                        android:textColor="#FF0000"
                        android:textSize="30dp" />

                    <TextView
                        android:id="@+id/txtHG"
                        android:layout_margin="2dp"
                        android:gravity="center"
                        android:text="HG"
                        android:textAppearance="?android:attr/textAppearanceMedium"
                        android:textColor="@color/abrv_bg_colors"
                        android:textSize="30dp" />
                </TableRow>

                <TableRow
                    android:id="@+id/tableRow8"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >

                    <CheckBox
                        android:id="@+id/chkBacteria"
                        android:layout_margin="2dp"
                        android:background="#FFFFFF"
                        android:tag="Bacteria"
                        android:textSize="30dp" />

                    <TextView
                        android:id="@+id/txtBacteria"
                        android:layout_margin="2dp"
                        android:background="@color/table_bg_colors"
                        android:gravity="center"
                        android:text="Bacteria/Pudrición"
                        android:textAppearance="?android:attr/textAppearanceMedium"
                        android:textColor="#FF0000"
                        android:textSize="30dp" />

                    <TextView
                        android:id="@+id/txtBac"
                        android:layout_margin="2dp"
                        android:gravity="center"
                        android:text="Bac"
                        android:textAppearance="?android:attr/textAppearanceMedium"
                        android:textColor="@color/abrv_bg_colors"
                        android:textSize="30dp" />
                </TableRow>

                <TableRow
                    android:id="@+id/tableRow9"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >

                    <CheckBox
                        android:id="@+id/chkKernelPopping"
                        android:layout_margin="2dp"
                        android:background="#FFFFFF"
                        android:tag="Kernel Popping"
                        android:textSize="30dp" />

                    <TextView
                        android:id="@+id/txtKernelPopping"
                        android:layout_margin="2dp"
                        android:background="@color/table_bg_colors"
                        android:gravity="center"
                        android:text="Kernel Popping"
                        android:textAppearance="?android:attr/textAppearanceMedium"
                        android:textColor="#FF0000"
                        android:textSize="30dp" />

                    <TextView
                        android:id="@+id/txtKP"
                        android:layout_margin="2dp"
                        android:gravity="center"
                        android:text="KP"
                        android:textAppearance="?android:attr/textAppearanceMedium"
                        android:textColor="@color/abrv_bg_colors"
                        android:textSize="30dp" />
                </TableRow>

                <TableRow
                    android:id="@+id/tableRow12"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >

                    <CheckBox
                        android:id="@+id/chkCommonSmut"
                        android:layout_margin="2dp"
                        android:background="#FFFFFF"
                        android:tag="Common Smut"
                        android:textSize="30dp" />

                    <TextView
                        android:id="@+id/txtKernelPopping"
                        android:layout_margin="2dp"
                        android:background="@color/table_bg_colors"
                        android:gravity="center"
                        android:text="Common Smut"
                        android:textAppearance="?android:attr/textAppearanceMedium"
                        android:textColor="#FF0000"
                        android:textSize="30dp" />

                    <TextView
                        android:id="@+id/txtCS"
                        android:layout_margin="2dp"
                        android:gravity="center"
                        android:text="CS"
                        android:textAppearance="?android:attr/textAppearanceMedium"
                        android:textColor="@color/abrv_bg_colors"
                        android:textSize="30dp" />
                </TableRow>

                <TableRow
                    android:id="@+id/tableRow13"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >

                    <CheckBox
                        android:id="@+id/chkMazPart"
                        android:layout_margin="2dp"
                        android:background="#FFFFFF"
                        android:tag="Mazorca partida durante Huskback"
                        android:textSize="30dp" />

                    <TextView
                        android:id="@+id/txtMazPart"
                        android:layout_margin="2dp"
                        android:background="@color/table_bg_colors"
                        android:gravity="center"
                        android:text="Mazorca partida"
                        android:textAppearance="?android:attr/textAppearanceMedium"
                        android:textColor="#FF0000"
                        android:textSize="30dp" />

                    <TextView
                        android:id="@+id/txtMP"
                        android:layout_margin="2dp"
                        android:gravity="center"
                        android:text="Maz Partida"
                        android:textAppearance="?android:attr/textAppearanceMedium"
                        android:textColor="@color/abrv_bg_colors"
                        android:textSize="30dp" />
                </TableRow>

                <TableRow
                    android:id="@+id/tableRow14"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >

                    <CheckBox
                        android:id="@+id/chkMazRem"
                        android:layout_margin="2dp"
                        android:background="#FFFFFF"
                        android:tag="Mazorca Removida"
                        android:textSize="30dp" />

                    <TextView
                        android:id="@+id/txtMazRem"
                        android:layout_margin="2dp"
                        android:background="@color/table_bg_colors"
                        android:gravity="center"
                        android:text="Mazorca removida"
                        android:textAppearance="?android:attr/textAppearanceMedium"
                        android:textColor="#FF0000"
                        android:textSize="30dp" />

                    <TextView
                        android:id="@+id/txtMR"
                        android:layout_margin="2dp"
                        android:gravity="center"
                        android:text="Removida"
                        android:textAppearance="?android:attr/textAppearanceMedium"
                        android:textColor="@color/abrv_bg_colors"
                        android:textSize="30dp" />
                </TableRow>

                <TableRow
                    android:id="@+id/tableRow15"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >

                    <CheckBox
                        android:id="@+id/chkNoPoll"
                        android:layout_margin="2dp"
                        android:background="#FFFFFF"
                        android:tag="No Poll"
                        android:textSize="30dp" />

                    <TextView
                        android:id="@+id/txtNoPoll"
                        android:layout_margin="2dp"
                        android:background="@color/table_bg_colors"
                        android:gravity="center"
                        android:text="No Poll"
                        android:textAppearance="?android:attr/textAppearanceMedium"
                        android:textColor="#FF0000"
                        android:textSize="30dp" />

                    <TextView
                        android:id="@+id/txtNP"
                        android:layout_margin="2dp"
                        android:gravity="center"
                        android:text="NP"
                        android:textAppearance="?android:attr/textAppearanceMedium"
                        android:textColor="@color/abrv_bg_colors"
                        android:textSize="30dp" />
                </TableRow>

                <TableRow
                    android:id="@+id/tableRow10"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >

                    <CheckBox
                        android:id="@+id/chkNoKernel"
                        android:layout_margin="2dp"
                        android:background="#FFFFFF"
                        android:tag="No Kernel"
                        android:onClick="KernelInspectionCheck"
                        android:textSize="30dp" />

                    <TextView
                        android:id="@+id/txtNoKernel"
                        android:layout_margin="2dp"
                        android:background="@color/table_bg_colors"
                        android:gravity="center"
                        android:text="No Kernel"
                        android:textAppearance="?android:attr/textAppearanceMedium"
                        android:textColor="#FF0000"
                        android:textSize="30dp" />

                    <TextView
                        android:id="@+id/txtNK"
                        android:layout_margin="2dp"
                        android:gravity="center"
                        android:text="NK"
                        android:textAppearance="?android:attr/textAppearanceMedium"
                        android:textColor="@color/abrv_bg_colors"
                        android:textSize="30dp" />
                </TableRow>
            </TableLayout>

            <TextView
                android:id="@+id/txtTitle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignLeft="@+id/btnSave"
                android:layout_alignParentTop="true"
                android:layout_marginTop="38dp"
                android:text="Choose"
                android:textAppearance="?android:attr/textAppearanceLarge" />

            <Spinner
                android:id="@+id/spnNoKernel"
                android:layout_width="500dp"
                android:layout_height="80dp"
                android:layout_below="@+id/tableLayout1"
                android:layout_centerHorizontal="true"
                android:layout_marginTop="30dp"
                android:tag="0" />

            <Button
                android:id="@+id/btnSave"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true"
                android:layout_centerHorizontal="true"
                android:onClick="SaveKernelInspection"
                android:text="Save" />

            <TextView
                android:id="@+id/txtKernelEstimate"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignLeft="@+id/spnNoKernel"
                android:layout_below="@+id/spnNoKernel"
                android:layout_marginTop="100dp"
                android:text="Kernel Estimate"
                android:textAppearance="?android:attr/textAppearanceLarge" />

            <EditText
                android:id="@+id/inputKernelEstimate"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignBaseline="@+id/txtKernelEstimate"
                android:layout_alignBottom="@+id/txtKernelEstimate"
                android:layout_marginLeft="20dp"
                android:layout_toRightOf="@+id/txtKernelEstimate"
                android:ems="10"
                android:inputType="number" >

            </EditText>
        </RelativeLayout>
    </ScrollView>

编辑2:问题似乎与我在标题部分中所做的跨度有关。我把它拿出来然后出现了复选框,但标题没有对齐。

1 个答案:

答案 0 :(得分:0)

请从复选框布局中删除android:background=.......行,然后才能生效。