ause by: android.view.InflateException: Binary XML file line #9 in com.kharchaApp:layout/contact_row



我正在卡片视图中传递值,但出现了以下错误:

android.view.InflateException:二进制XML文件行#9在com中。kharchaApp:layout/contact_row:二进制XML文件列#9在com中。khaarchaApp:layout/contact_row:膨胀类时出错引起原因:android.view.InflateException:com.kharchAAP:layout/contact_row中的二进制XML文件行#9:膨胀类时出错引起原因:java.lang.reflect.InvocationTargetException

<com.google.android.material.card.MaterialCardView
android:id="@+id/transction"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="transaction_chat"
android:layout_margin="10dp"
app:cardBackgroundColor="@color/transparent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:strokeColor="@color/colorAccent"
app:strokeWidth="2dp"
android:tag="0">
<androidx.cardview.widget.CardView
android:id="@+id/transction"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="transaction_chat"
android:layout_margin="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:strokeColor="@color/colorAccent"
app:strokeWidth="2dp"
android:tag="0"/>

您可以在xml文件中使用androidx-cardView元素,而不是材质Card View。它的行为与材质卡片视图相同。

转换到androidx.cardview.widget.cardview解决了我的问题。非常感谢。

相关内容

最新更新