Chaque fois que j'exécute l'application, une erreur d'exécution bloque l'application. Ceci est mon erreur de journal:Dessiner une ligne gris foncé en XML provoque une erreur d'exécution
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.android.practiceset2/com.example.android.practiceset2.MainActivity}: android.view.InflateException: Binary XML file line #63: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
L'erreur n'apparaît que si je dessine une ligne grise entre deux vues en utilisant une vue gris foncé blanc de largeur 1DP dans mon fichier XML donné ci-dessous:
<LinearLayout 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:orientation="vertical"
tools:context=".MainActivity">
<android.support.v7.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:orientation="horizontal">
<android.support.v7.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:padding="4dp"
android:text="Team A"
android:textSize="45sp" />
<TextView
android:id="@+id/scoreA_text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:padding="4dp"
android:text="0"
android:textSize="45sp" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:gravity="center_horizontal"
android:onClick="score3A"
android:text="+3 Points" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:gravity="center_horizontal"
android:onClick="score2A"
android:text="+2 Points" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:gravity="center_horizontal"
android:onClick="freeThrowA"
android:text="Free Throw" />
</android.support.v7.widget.LinearLayoutCompat>
<view
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@android:color/darker_gray" />
<android.support.v7.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:padding="4dp"
android:text="Team B"
android:textSize="45sp" />
<TextView
android:id="@+id/scoreB_text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:padding="4dp"
android:text="0"
android:textSize="45sp" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:gravity="center_horizontal"
android:onClick="score3B"
android:text="+3 Points" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:gravity="center_horizontal"
android:onClick="score2B"
android:text="+2 Points" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:gravity="center_horizontal"
android:onClick="freeThrowB"
android:text="Free Throw" />
</android.support.v7.widget.LinearLayoutCompat>
</android.support.v7.widget.LinearLayoutCompat>
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="65dp"
android:layout_weight="1"
android:gravity="center_horizontal"
android:onClick="reset"
android:text="Reset" />
</LinearLayout>
I ne peut pas comprendre comment dessiner cette ligne provoque une erreur. Est-ce la bonne façon de faire cela? Sinon, suggérez un moyen de contourner le problème.
Salut, camarade vampire – sasha199568