ANDROID Problemi di rendering NullException

Sono un novizio nella programmazione android. Ho cercato di creare un'applicazione di cronometro, ma recentemente ho trovato un errore nel layout. Ho eseguito il debug di questo errore di layout per 2 giorni e ancora non riesco a trovare la soluzione. Non credo che questo sia problema IDE perché quando l'ho testato utilizzando il mio telefono, il programma si è fermato (errore).

Date un'occhiata all'errore riportto di seguito:

  • Ultima miniatura dell'app Android
  • java.lang.IllegalMonitorStateException: object non bloccato dal thread prima di attendere ()?
  • Aiutare a passare un ArrayList degli oggetti a una nuova attività
  • Cerca il contatto per numero di telefono
  • Cattura quando l'applicazione Android è andata sullo background
  • Firebase Nessuna properties; di serializzazione trovata nella class
  • java.lang.NullPointerException a android.widget.LinearLayout.forceUniformHeight (LinearLayout.java:1380) a

    android.widget.LinearLayout.measureHorizontal (LinearLayout.java:1368) a android.widget.TableRow.onMeasure (TableRow.java:114) a android.view.View.measure (View.java:17430) a android.view.ViewGroup .measureChildWithMargins (ViewGroup.java:5463) a android.widget.LinearLayout.measureChildBeforeLayout (LinearLayout.java:1436) a android.widget.TableLayout.measureChildBeforeLayout (TableLayout.java:464) a android.widget.LinearLayout.measureVertical (LinearLayout. java: 722) a android.widget.TableLayout.measureVertical (TableLayout.java:476) a android.widget.TableLayout.onMeasure (TableLayout.java:439) a android.view.View.measure (View.java:17430) a android.view.ViewGroup.measureChildWithMargins (ViewGroup.java:5463) a android.widget.FrameLayout.onMeasure (FrameLayout.java:430) a android.view.View.measure (View.java:17430) a android.widget.LinearLayout .measureVertical (LinearLayout.java:875) a android.widget.LinearLayout.onMeasure (LinearLayout.java:613) in android. view.View.measure (View.java:17430) a android.widget.LinearLayout.measureVertical (LinearLayout.java:875) a android.widget.LinearLayout.onMeasure (LinearLayout.java:613) a android.view.View.measure (View.java:17430)

    questo è il mio codice:

    <?xml version="1.0" encoding="utf-8"?> <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity" style="@style/activity_style"> <TableRow android:layout_height="0dp" android:layout_width="match_parent" android:layout_weight="2"> <EditText style="@style/edit_text_timer" android:id="@+id/etHour" android:hint="@string/initial_value" android:layout_height="match_parent" android:layout_width="0dp" android:layout_weight="3" android:layout_column="6" /> <TextView android:id="@+id/tvColon" android:layout_height="match_parent" android:layout_width="0dp" android:text="@string/colon_text_view" android:gravity="center" android:textColor="#e7ff00" android:textSize="30sp" android:layout_weight="1"/> <EditText style="@style/edit_text_timer" android:id="@+id/etMinute" android:hint="@string/initial_value" android:layout_height="match_parent" android:layout_width="0dp" android:layout_weight="3" android:layout_column="13" /> <TextView android:id="@id/tvColon" android:layout_height="match_parent" android:layout_width="0dp" android:text="@string/colon_text_view" android:gravity="center" android:textColor="#e7ff00" android:textSize="30sp" android:layout_weight="1" android:layout_column="18" /> <EditText style="@style/edit_text_timer" android:id="@+id/etSecond" android:hint="@string/initial_value" android:layout_height="match_parent" android:layout_width="0dp" android:layout_weight="3" /> </TableRow> <TableRow android:layout_height="0dp" android:layout_weight="1" android:layout_width="match_parent"> <Button style="@style/button_text" android:id="@+id/button1" android:layout_width="0dp" android:text="@string/button_1" android:layout_weight="1" android:onClick="buttonNumber"/> <Button style="@style/button_text" android:id="@+id/button2" android:layout_width="0dp" android:text="@string/button_2" android:layout_weight="1" android:onClick="buttonNumber"/> <Button style="@style/button_text" android:id="@+id/button3" android:layout_width="0dp" android:text="@string/button_3" android:layout_weight="1" android:onClick="buttonNumber"/> </TableRow> <TableRow android:layout_height="0dp" android:layout_weight="1" android:layout_width="match_parent"> <Button style="@style/button_text" android:id="@+id/button4" android:layout_width="0dp" android:text="@string/button_4" android:layout_weight="1" android:onClick="buttonNumber" /> <Button style="@style/button_text" android:id="@+id/button5" android:layout_width="0dp" android:text="@string/button_5" android:layout_weight="1" android:onClick="buttonNumber"/> <Button style="@style/button_text" android:id="@+id/button6" android:layout_width="0dp" android:text="@string/button_6" android:layout_weight="1" android:onClick="buttonNumber"/> </TableRow> <TableRow android:layout_height="0dp" android:layout_weight="1" android:layout_width="match_parent"> <Button style="@style/button_text" android:id="@+id/button7" android:layout_width="0dp" android:text="@string/button_7" android:layout_weight="1" android:onClick="buttonNumber"/> <Button style="@style/button_text" android:id="@+id/button8" android:layout_width="0dp" android:text="@string/button_8" android:layout_weight="1" android:onClick="buttonNumber"/> <Button style="@style/button_text" android:id="@+id/button9" android:layout_width="0dp" android:text="@string/button_9" android:layout_weight="1" android:onClick="buttonNumber"/> </TableRow> <TableRow android:layout_weight="1" android:layout_height="0dp" android:layout_width="match_parent"> <Button style="@style/button_text" android:id="@+id/emptyButton" android:layout_width="0dp" android:text="" android:layout_weight="1"/> <Button style="@style/button_text" android:id="@+id/button0" android:layout_width="0dp" android:text="@string/button_0" android:layout_weight="1" android:onClick="buttonNumber"/> <Button style="@style/button_text" android:id="@+id/buttonReset" android:layout_width="0dp" android:text="@string/button_reset_text" android:layout_weight="1"/> </TableRow> <TableRow android:layout_weight="1" android:layout_height="0dp" android:layout_width="match_parent"> <Button style="@style/button_text" android:layout_marginTop="10dp" android:id="@+id/startStopButton" android:layout_width="0dp" android:text="@string/button_start" android:layout_weight="1"/> <Button style="@style/button_text" android:layout_marginTop="10dp" android:id="@+id/resetButton" android:layout_width="0dp" android:text="@string/button_reset" android:layout_weight="1"/> </TableRow> </TableLayout> enter code here 

  • il figlio specificato ha già un genitore
  • Perché il frammento non è in grado di ricevere un pacchetto non salvato NintendoStationState durante la rotazione, se viene creato tramite XML?
  • Conversione del discorso al text
  • Applicazione Android che si blocca inaspettatamente
  • BACK-PORTING può utilizzare PdfDocument (API 19) in jellybean API 16?
  • MediaStore.Video.Thumbnails.getThumbnail () restituisce null
  • One Solution collect form web for “ANDROID Problemi di rendering NullException”

    I bambini di un TableRow non devono specificare gli attributi layout_width e layout_height nel file XML. TableRow applica sempre tali valori per rispettivamente MATCH_PARENT e WRAP_CONTENT.

    Prova questo:

     <?xml version="1.0" encoding="utf-8"?> <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity" style="@style/activity_style"> <TableRow android:layout_height="0dp" android:layout_width="match_parent" android:layout_weight="2"> <EditText style="@style/edit_text_timer" android:id="@+id/etHour" android:hint="@string/initial_value" android:layout_weight="3" android:layout_column="6" /> <TextView android:id="@+id/tvColon" android:text="@string/colon_text_view" android:gravity="center" android:textColor="#e7ff00" android:textSize="30sp" android:layout_weight="1"/> <EditText style="@style/edit_text_timer" android:id="@+id/etMinute" android:hint="@string/initial_value" android:layout_weight="3" android:layout_column="13" /> <TextView android:id="@id/tvColon" android:text="@string/colon_text_view" android:gravity="center" android:textColor="#e7ff00" android:textSize="30sp" android:layout_weight="1" android:layout_column="18" /> <EditText style="@style/edit_text_timer" android:id="@+id/etSecond" android:hint="@string/initial_value" android:layout_weight="3" /> </TableRow> <TableRow android:layout_height="0dp" android:layout_weight="1" android:layout_width="match_parent"> <Button style="@style/button_text" android:id="@+id/button1" android:text="@string/button_1" android:layout_weight="1" android:onClick="buttonNumber"/> <Button style="@style/button_text" android:id="@+id/button2" android:text="@string/button_2" android:layout_weight="1" android:onClick="buttonNumber"/> <Button style="@style/button_text" android:id="@+id/button3" android:text="@string/button_3" android:layout_weight="1" android:onClick="buttonNumber"/> </TableRow> <TableRow android:layout_height="0dp" android:layout_weight="1" android:layout_width="match_parent"> <Button style="@style/button_text" android:id="@+id/button4" android:text="@string/button_4" android:layout_weight="1" android:onClick="buttonNumber" /> <Button style="@style/button_text" android:id="@+id/button5" android:text="@string/button_5" android:layout_weight="1" android:onClick="buttonNumber"/> <Button style="@style/button_text" android:id="@+id/button6" android:text="@string/button_6" android:layout_weight="1" android:onClick="buttonNumber"/> </TableRow> <TableRow android:layout_height="0dp" android:layout_weight="1" android:layout_width="match_parent"> <Button style="@style/button_text" android:id="@+id/button7" android:text="@string/button_7" android:layout_weight="1" android:onClick="buttonNumber"/> <Button style="@style/button_text" android:id="@+id/button8" android:text="@string/button_8" android:layout_weight="1" android:onClick="buttonNumber"/> <Button style="@style/button_text" android:id="@+id/button9" android:text="@string/button_9" android:layout_weight="1" android:onClick="buttonNumber"/> </TableRow> <TableRow android:layout_weight="1" android:layout_height="0dp" android:layout_width="match_parent"> <Button style="@style/button_text" android:id="@+id/emptyButton" android:text="" android:layout_weight="1"/> <Button style="@style/button_text" android:id="@+id/button0" android:text="@string/button_0" android:layout_weight="1" android:onClick="buttonNumber"/> <Button style="@style/button_text" android:id="@+id/buttonReset" android:text="@string/button_reset_text" android:layout_weight="1"/> </TableRow> <TableRow android:layout_weight="1" android:layout_height="0dp" android:layout_width="match_parent"> <Button style="@style/button_text" android:layout_marginTop="10dp" android:id="@+id/startStopButton" android:text="@string/button_start" android:layout_weight="1"/> <Button style="@style/button_text" android:layout_marginTop="10dp" android:id="@+id/resetButton" android:text="@string/button_reset" android:layout_weight="1"/> </TableRow> </TableLayout> 

    Spero che sia d'aiuto!

    L'Android è un fan Android di Google, tutto su telefoni Android, Android Wear, Android Dev e applicazioni Android Games e così via.