java - android.view.InflateException: Binary XML file line #16: Binary XML file line #16: Error inflating class Button
问题描述
我的代码中出现此错误。请帮我解决这个问题。
android.view.InflateException:二进制 XML 文件第 16 行:二进制 XML 文件第 16 行:在 android.view.LayoutInflater.inflate(LayoutInflater.java:543) 在 android.view.LayoutInflater.inflate(LayoutInflater. java:427) 在 com.kensai.kensaicashier.adapter.EditMenuAdapter.onCreateViewHolder(EditMenuAdapter.kt:14) 在 android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:6685)
这是我的 xml 文件
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">
<RelativeLayout
android:id="@+id/lay4"
android:layout_width="match_parent"
android:layout_height="30dp"
android:background="@color/colorGray">
<TextView
android:id="@+id/waktu_pesan_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/waktu_pesan"
android:textColor="@color/colorBlack"
android:textSize="16sp"
android:layout_centerVertical="true"
android:layout_marginStart="40dp" />
<TextView
android:id="@+id/waktu_pesan"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="13:44"
android:textColor="@color/colorBlack"
android:textSize="16sp"
android:layout_marginStart="140dp"
android:background="@color/colorGray"
android:layout_centerVertical="true"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/lay5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginStart="40dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/total_pesanan_title"
android:textColor="@color/colorBlack"
android:layout_centerVertical="true"/>
<TextView
android:id="@+id/total_pesanan"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="8 item"
android:textColor="@color/colorBlack"
android:layout_marginStart="100dp"
android:layout_centerVertical="true"/>
<Button
android:id="@+id/btn_tambah_menu"
android:layout_width="150dp"
android:layout_height="30dp"
android:text="@string/tambah_menu"
android:textSize="16sp"
android:textColor="@color/colorWhite"
android:background="@drawable/round_button_solid"
android:layout_alignParentEnd="true"
android:layout_marginEnd="40dp"
android:layout_marginBottom="10dp"
android:layout_centerVertical="true"
android:textAllCaps="false"/>
</RelativeLayout>
<ScrollView
android:id="@+id/scrollView_take_away"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/lay5"
android:layout_below="@id/lay4">
<android.support.v7.widget.CardView
android:id="@+id/card_order_take_away"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="40dp"
android:layout_marginEnd="40dp"
android:layout_marginTop="10dp"
app:contentPadding="10dp"
app:cardElevation="5dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/rec_edit_menu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false" />
<android.support.v7.widget.RecyclerView
android:id="@+id/rec_order_take_away"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/rec_edit_menu"/>
</RelativeLayout>
</android.support.v7.widget.CardView>
</ScrollView>
</RelativeLayout>
解决方案
推荐阅读
- c# - 不能在泛型类中使用参数,因为不能转换为基类,尽管所有约束似乎都很好
- ruby-on-rails - 使用失败的路由请求记录 IP,NGINX/Rails
- react-native - React-Navigation 和安装错误和首次使用
- python - 如何绘制多变量函数的平滑等高线/水平曲线
- selenium - 如果项目不在 C 驱动器中,如何在 selenium c# 中使用 WebDriverManager
- google-bigquery - 在 Google Data Studio 中创建动态日期参数时出现问题
- java - 在不指定分区的情况下运行 kafka 消费者
- html - 我无法在锚标签中垂直对齐图标
- spring-boot - Spring Boot SAML SSO 自定义 JWT 令牌刷新
- typescript - Typescript - 使用字符串获取名称的属性,作为通用类型