2012-05-04 10 views
0

XMLレイアウトに問題があります。 。あなたは下の画像でわかるように、TextViewには、任意のandroid:textフィールドが含まれていないチェックボックス(の隣にあり、私はスペースを削除することができますどのように私は青で下線まし空白を含むチェックボックスとテキストビューの整列

enter image description here

コード:?

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical" > 

    <Button 
     android:id="@+id/bDisinstalla" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_gravity="center" 
     android:layout_marginTop="5dp" 
     android:text="@string/disinstalla" 
     android:textColor="#FF0000" 
     android:textSize="26dp" /> 

    <ScrollView 
     android:id="@+id/scrollView1" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:fadeScrollbars="true" > 

     <TableLayout 
      android:id="@+id/tableLayout1" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" > 

      <CheckBox 
       android:id="@+id/cbAbilitaServizio" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="@string/abilita_servizio" > 
      </CheckBox> 

      <CheckBox 
       android:id="@+id/cbSpegniSchermo" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="@string/spegni_schermo" > 
      </CheckBox> 

      <CheckBox 
       android:id="@+id/cbLandscape" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="@string/landscape" > 
      </CheckBox> 

      <Button 
       android:id="@+id/bCalibrazione" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_gravity="center" 
       android:text="@string/calibrazione" /> 

問題のコード:コードの

  <!-- 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>  
+1

あなたが読んで、あなたのレイアウトには多くのTextViewがある問題 – Javanator

+0

にのみ、単一のチェックボックスと、単一のTextView XMLコードを貼り付けることができますと – Javanator

+0

されます不要なものを取り除く – Hoconosc

答えて

0

Stringを表示するために別個のTextViewを使用するのではなく、Checkboxのtextプロパティを使用するのはなぜですか?

  <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" /> 
関連する問題