Android View Inflate Exception (Nullpoint)



我有列表项行,它非常有效,直到我添加视图作为边框,我得到一个 NullPointerException。我不明白。如果我评论视图,一切都会好起来的。

<android.support.v7.widget.CardView
android:id="@+id/cardView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/custom_bg"
android:focusable="true"
card_view:cardElevation="4dp"

card_view:cardUseCompatPadding="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/custom_bg"
android:orientation="vertical">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<TextView
android:id="@+id/tvUpazilas"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:text="Upazila Name :"
android:textColor="#73A7D5"
android:textStyle="bold" />
<TextView
android:id="@+id/tvUpazilaName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:text="Upazila Name"
android:textColor="#2F3133" />

</LinearLayout>
<view
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#dbe3f1" />
</LinearLayout>
</android.support.v7.widget.CardView>

</LinearLayout>

日志猫

com.primetech.gis E/UncaughtException: android.view.InflateException: Binary XML file line #67: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:768)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:734)

请替换这个

<view
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#dbe3f1" />

有了这个

<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#dbe3f1" />

最新更新