ice*_*rit 9 android android-databinding
我正在尝试在 android 中实现数据绑定示例并创建一个带有可绑定变量的 POJO,我收到此错误!请帮忙。我正在关注本教程 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);
}
}
Run Code Online (Sandbox Code Playgroud)
Jam*_*ido 14
您应该将这些代码行添加到您的应用程序级别的 gradle 文件中,如1.2 部分所述
android {
....
dataBinding {
enabled = true
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3673 次 |
| 最近记录: |