【问题标题】:Error Caused by org.xmlpull.v1.XmlPullParserException由 org.xmlpull.v1.XmlPullParserException 引起的错误
【发布时间】:2021-02-08 17:39:49
【问题描述】:

由 org.xmlpull.v1.XmlPullParserException 引起(Android 4.4.4 & 4.4.2) 二进制 XML 文件第 1 行:无效的可绘制标签矢量 mobile.push.PushAdapter.onCreateViewHolder (PushAdapter.java:68)

它是我的持有者

    private class UserViewHolder extends RecyclerView.ViewHolder {
    TextView title;
    TextView time;
    TextView short_text;
    TextView body;
    View view1;
    ExpandableLayout expand;

    public UserViewHolder(View view) {
        super(view);
        view1 = view.findViewById(R.id.container);
        title = view.findViewById(R.id.title);
        time = view.findViewById(R.id.time);
        short_text = view.findViewById(R.id.short_text);
        body = view.findViewById(R.id.body);
        expand = view.findViewById(R.id.expand);
    }
}

第 68 行 ->

//onCreateViewHolder
        View view = LayoutInflater.from(activity).inflate(R.layout.item_push, parent, false);
        return new UserViewHolder(view);

XML item_push.xml

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <TextView
            android:id="@+id/title"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"/>

        <TextView
            android:id="@+id/short_text"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"/>

        <TextView
            android:id="@+id/time"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="2018-02-01 04:54" />

        <net.cachapa.expandablelayout.ExpandableLayout
            android:id="@+id/expand"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:el_duration="1000"
            app:el_expanded="false"
            app:el_parallax="0.5">

            <TextView
                android:id="@+id/body"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"/>
        </net.cachapa.expandablelayout.ExpandableLayout>

我该怎么办?无法在 Android 4.4.2 上测试

【问题讨论】:

    标签: java android xml textview


    【解决方案1】:

    在 app 模块的 build.gradle 文件中添加语句:

    android {
          defaultConfig {
            vectorDrawables.useSupportLibrary = true
          }
        }
    

    查看this

    【讨论】:

    • 用过没用
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-11-18
    • 1970-01-01
    • 2012-09-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多