2011-12-15 38 views
11

Así que no veo dónde lo está lanzando en android.view.ViewGroup Aparece este mensaje de error cuando intento ver mi xml en la vista gráfica. No he hecho nada con la java real, esto también se aplica.android.widget.TextView no se puede convertir en android.view.ViewGroup

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:background="#ffffffff" 
android:orientation="vertical" > 

<TableLayout 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:layout_gravity="center" 
    android:stretchColumns="1" > 

    <TableRow 
     android:layout_width="fill_parent" 
     android:layout_height="1.0dp" 
     android:background="@drawable/list_divider_holo_light" /> 

    <TableRow 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" > 

Aquí me cansé de hacer un estilo con estos elementos y no lo aceptó.

 <TextView 
      android:id="@+id/textView1" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center_vertical" 
      android:layout_marginLeft="25dp" 
      android:text="@string/add_alarm" 
      android:textAppearance="?android:attr/textAppearanceSmall" 
      android:textColor="#ff505050" 
      android:textSize="18.0sp" /> 

     <Button 
      android:id="@+id/bSetTimer" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center_vertical" 
      android:layout_marginLeft="100.0dp" 
      android:text="Button" /> 
    </TableRow> 

    <Button 
     android:id="@+id/bSetAlarm" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="Button" /> 

    <TextView 
     android:id="@+id/textView2" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:text="Small Text" > 

     <TableRow 
      android:layout_width="fill_parent" 
      android:layout_height="2.0dp" 
      android:background="@drawable/list_divider_holo_light" /> 

     <TableRow 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:paddingTop="10dp" > 

      <TextView 
       android:layout_height="20.0dp" 
       android:layout_gravity="center_horizontal" 
       android:layout_marginLeft="40.0dp" 
       android:paddingLeft="25.0dip" 
       android:text="@string/alarm_volume_title" /> 
     </TableRow> 

     <SeekBar 
      android:id="@+id/default_volume_seekbar" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="15.0dp" 
      android:paddingTop="2.0dip" /> 
    </TextView> 
</TableLayout> 

Respuesta

21

La vista de texto textView2 se no se ha cerrado (Es justo antes de cerrar la tabla layout), y la duración es tratar de echarlo a un viewgroup con el fin de añadir las 2 filas de la tabla y seekbar.

+0

oh .... wow Lo estaba buscando en mi textView1 ... ¡Jaja gracias! – domshyra

5

Está tratando de poner otros elementos dentro de su TextView (@+id/textView2). Eso no es válido porque, como dice el error, no es un ViewGroup.

+0

Ah, muchas gracias :) – domshyra

Cuestiones relacionadas