databinding 和RecycleView 需要Observable Binding双向绑定
public class SalesNewInfo extends BaseObservable {
private String title;
private Boolean isBegging;
public String getTitle() {
return title;
}
@Bindable
public void setTitle(String title) {
this.title = title;
notifyPropertyChanged(BR.title);
}
public Boolean getBegging() {
return isBegging;
}
@Bindable
public void setBegging(Boolean begging) {
isBegging = begging;
notifyPropertyChanged(BR.begging);
}
其中set的地方用到了@Bindable 和notifyPropertyChanged( )以便实现双向绑定
item layout中布局需要添加
<data>
<variable
name="item"
type="com.ubtechinc.cruzr.easyhomeapp.model.SalesNewInfo" />
</