databinding 自定义控件设置属性遇到的问题

Error:Execution failed for task ':app:compileDebugJavaWithJavac'. > android.databinding.tool.util.LoggedErrorException: Found data binding errors. ****/ data binding error ****msg:Cannot find the setter for attribute 'app:show_value' with parameter type int on com.yarui.app.client.ui.view.lcfengview.AddSubtractLinearLayout. file:E:\work_space\aa\app\src\main\res\layout\activity_plan_add_edit.xml loc:208:46 - 208:63 ****\ data binding error ****

 

当你遇到上述问题的时候,应更是你没有设置set 属性操作,例如下面:

@BindingAdapter({"show"})   

public static void setText(View textView, String user) {

    textView.setText(user);

}

  --->请注意BindingAdapter括号里面还有一个花括号呢,这个对应的就是你的布局文件中的 app:show="hello" 属性哦

参考:https://medium.com/androiddevelopers/android-data-binding-custom-setters-55a25a7aea47  解决报错问题

          https://blog.csdn.net/csc48656/article/details/73009398   解决报警问题

转载于:https://my.oschina.net/f839903061/blog/1944600

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值