猿问

android.view.InflateException 二进制 XML 文件第 0 行:

android.view.InflateException 二进制 XML 文件第 0 行:错误导致类膨胀:java.lang.reflect.InvocationTargetException


员工布局.xml 文件

<?xml version="1.0" encoding="utf-8"?>

<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"

    xmlns:app="http://schemas.android.com/apk/res-auto"

    android:orientation="vertical"

    android:layout_width="match_parent"

    android:layout_height="wrap_content"

    app:cardElevation="10dp"

    app:cardBackgroundColor="@color/cardview_light_background"

    >


    <LinearLayout

        android:orientation="vertical"

        android:layout_width="match_parent"

        android:layout_height="wrap_content"

        android:background="?android:backgroundSplit"

        android:padding="10dp"

        >


        <TextView

            android:id="@+id/name"

            android:layout_width="wrap_content"

            android:layout_height="wrap_content"

            android:text="@string/name"

            android:textColor="@android:color/black"

            android:textSize="15sp"

            android:textStyle="bold"/>

        <TextView

            android:id="@+id/type"

            android:layout_width="wrap_content"

            android:layout_height="wrap_content"

            android:text="@string/type"

            android:textColor="@android:color/black"

            android:textSize="15sp"

            android:textStyle="normal"/>


    </LinearLayout>


</android.support.v7.widget.CardView>


达令说
浏览 137回答 1
1回答

神不在的星期二

android.R.attr.backgroundSplit用于拆分 ActionBar(在布局底部显示额外的按钮等)。它确实定义了背景,但根据文档,它可以引用任何类型的资源、任何类型的主题,甚至只是一个直接的十六进制颜色字符串。LinearLayout 的背景字段只能采用颜色、颜色参考或可绘制参考。
随时随地看视频慕课网APP

相关分类

Java
我要回答