我"cannot find flag:2 invalidate any flag:{6}"收到此错误,尝试使用"afterTextCahnged"在数据类中从编辑文本中解析数据



如何解决此错误?//数据类中的setter函数

fun setSize(editable: Editable) {
editable.toString().toDoubleOrNull()?.let { size = it }
} 

在xml 中

<EditText
android:afterTextChanged="@{Text -> shoeListingsViewModel.shoe.setSize(Text)}" />

我认为您在text参数中缺少副题。

android:afterTextChanged="@{(text) -> shoeListingsViewModel.shoe.setSize(text)}" />

最新更新