0

所以我刚刚学会了如何通过 Github 和 JitPack 发布我自己的库(只是一些实用功能),这是我的代码:

https://github.com/xht418/Util-Kotlin/tree/main/utlikotlin/src/main/java/com/example/utlikotlin

我的问题是,Double.roundDecimal()已识别,但无法识别我的自定义 DataBinding 属性isAddCase,显示AAPT: error: attribute isAddCase (aka com.example.shapeableimageviewtest:isAddCase) not found.

我在一个新项目中尝试过:

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

    <data>
        <variable
            name="name"
            type="String" />

    </data>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center"
        android:orientation="vertical">

        <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@{name}"
            app:isAddCase="true"/>    //either "isAddCase" or "app:isAddCase", doesn't work

    </LinearLayout>

</layout>
4

1 回答 1

1

你必须app:isAddCase=true改变app:isAddCase="@{true}"

于 2020-11-09T16:09:20.100 回答