问题描述
所以我刚刚学习了如何通过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>
解决方法
您必须将app:isAddCase=true
更改为app:isAddCase="@{true}"