Bindable must be on a member in an Observable class.报错解决

来源:互联网 发布:拓普康怎样导入数据 编辑:程序博客网 时间:2024/05/18 15:05

Bindable must be on a member in an Observable class.报错解决


在使用databinding时报错,实体类必须继承BaseObservable,我的实体如下:

public class Food extends BaseObservable {    private String img;    private String description;    private String keywords;    public Food(String img, String description, String keywords) {        this.img = img;        this.description = description;        this.keywords = keywords;    }    @BindingAdapter("bind:img")    public static void getImage(ImageView view, String url){        Picasso.with(view.getContext()).load(url).into(view);    }    @Bindable    public String getImg() {        return img;    }    public void setImg(String img) {        this.img = img;    }    @Bindable    public String getDescription() {        return description;    }    public void setDescription(String description) {        this.description = description;    }    @Bindable    public String getKeywords() {        return keywords;    }    public void setKeywords(String keywords) {        this.keywords = keywords;    }}


阅读全文
0 0
原创粉丝点击