我正在尝试在edittext中使用数据绑定,早上它工作正常但突然出现错误:
****/ data binding error ****msg:Cannot find the getter for attribute 'android:text' with value type java.lang.String on android.widget.EditText. file:/home/itstym/ApkProjects/Reminder/app/src/main/res/layout/activity_main.xml loc:20:4 - 34:40 ****\ data binding error ****
20:4 -34:40 行的 EditText
<EditText
app:error="@{login.errorEmail}"
android:text="@={login.userEmailAddress}"
android:hint="Email Address"
android:id="@+id/email_address"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:ems="10"
android:inputType="textPersonName"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="24dp"/>
查看持有人:
@Bindable
var userEmailAddress:String = String()
set(userEmailAddress){
field=userEmailAddress
notifyPropertyChanged(R.id.email_address)
/*to check Email for validation on every character inserted by user*/
notifyPropertyChanged(BR.errorEmail)
}
get() {
return field
}
突然出了什么问题?
尝试的解决方案: 1. 使缓存无效并重新启动。2.清理项目和重建项目。