美文网首页
Data Binding Observable

Data Binding Observable

作者: Perston | 来源:发表于2020-05-19 15:05 被阅读0次
    • BaseObservable 两种域改变通知UI刷新

    @Bindable和notifyPropertyChanged(BR.xxx);通知相关的UI刷新,可视为局部刷新

        @Bindable
        public String getFirstName() {
            return firstName;
        }
    
        public void setFirstName(String firstName) {
            this.firstName = firstName;
            notifyPropertyChanged(BR.firstName);
        }
    

    notifyChange();可视为和这个model相关的UI全部刷新

        public void setFired(boolean fired) {
            isFired = fired;
            notifyChange();
        }
    

    相关文章

      网友评论

          本文标题:Data Binding Observable

          本文链接:https://www.haomeiwen.com/subject/bhdbohtx.html