android - @BidingMethod 不适用于方法

标签 android data-binding

我正在使用 BindingMethod here像这样

@BindingMethod(type = InputView.class, attribute = "android:title", method = "setTitle")

但是显示错误

enter image description here

如何使用 BindingMethod

最佳答案

当我将@BindingMethod 放入类中时,出现了这个问题。
所以把它放在类之上

@BindingMethods({
        @BindingMethod(type = InputView.class, attribute = "app:title", method = "setTitle")
})
public class InputView extends LinearLayout {
   ...
}

关于android - @BidingMethod 不适用于方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40583738/

相关文章:

android - 试图在 android 中保存上次搜索的类

android - Dropbox 同步 API 不返回没有扩展名的文件

javascript - 数据绑定(bind)到 Polymer 中的动态路径

wpf - 绑定(bind)到数据上下文之外的属性

WPF:ComboBox DisplayMemberPath 突然不再显示了?

android - SonarLint 命令行工具 - 添加文件/文件夹异常(exception)

java - 使用 Retrofit、RxJava 和 Observable.share 进行重新身份验证?

android - 如何避免 Android 中的 GPS 漂移?

javascript - 如何将复选框值数据绑定(bind)到 Javascript 对象

c# - WPF TimeSpan 绑定(bind)到没有毫秒的标签