Kelin-Hong / MVVMLight

A toolkit help to build Android MVVM Application
1.85k stars 333 forks source link

relaycommand 绑定错误 #16

Closed caoanqi closed 7 years ago

caoanqi commented 7 years ago

Error:Execution failed for task ':app:compileDebugJavaWithJavac'.

java.lang.RuntimeException: Found data binding errors. / data binding error msg:Cannot find the setter for attribute 'app:afterTextChangedCommand' with parameter type com.zhuniu.smart.library.mvvmlight.command.ReplyCommand on android.widget.EditText. file:E:\Company\Project\zn_purchase_cloud\PCloud\app\src\main\res\layout\activity_acceptance_check_list_info.xml loc:238:47 - 238:67 \ data binding error

我是down的代码库,进行引用的。 绑定事件时出现这个错误 请问什么原因?如何解决?谢谢


当我使用网络依赖 引用 是可以使用的但是管于EditText组件的command 事件引用,没有去执行 public final ReplyCommand afterTextChangedCommand = new ReplyCommand<>(() -> { Log.e("commond cao", "invoke"); receiptAmount.set(String.valueOf(Double.valueOf(mAcceptanceCheckListInfoModel.get().getTransactionPrice()) * Double.valueOf(mAcceptanceCheckListInfoModel.get().getActualReceivedCount()))); });

想问下什么问题?

Kelin-Hong commented 7 years ago

这个是EditText 文本改变的时候回调,会把当前EditText的文本当做参数带回来,你改成 public final ReplyCommand afterTextChangedCommand =new ReplyCommand<>((str) -> { //str 当前EditText改变后的文本 }