我正在尝试在 android 中实现数据绑定示例并使用可绑定变量创建 POJO,但我收到此错误!请帮忙。我正在关注这个教程http://www.vogella.com/tutorials/AndroidDatabinding/article.html http://www.vogella.com/tutorials/AndroidDatabinding/article.html这是我的代码
import android.databinding.BaseObservable;
import android.databinding.Bindable;
public class TemperatureData extends BaseObservable {
private String location;
private String celsius;
public TemperatureData(String location, String celsius) {
this.location = location;
this.celsius = celsius;
}
@Bindable
public String getCelsius() {
return celsius;
}
@Bindable
public String getLocation() {
return location;
}
public void setLocation(String location){
this.location = location;
notifyPropertyChanged(BR.location);
}
public void setCelsius(String celsius) {
this.celsius = celsius;
notifyPropertyChanged(BR.celsius);
}
}
您应该将这些代码行添加到您的应用程序级 gradle 文件中,如1.2节 http://www.vogella.com/tutorials/AndroidDatabinding/article.html#enable-data-binding-in-your-android-application
android {
....
dataBinding {
enabled = true
}
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)