美文网首页
@Bindable 和@get:Bindable

@Bindable 和@get:Bindable

作者: Sarah_love | 来源:发表于2020-11-04 15:58 被阅读0次

======================================================================================

1.@get:Bindable的使用 in Kotlin

 @get:Bindable

var capacity: String =vendorProfile.searchCriteria

        ?.let { FacetDataManager(it).guestCapacityDefaultName }

        ?.takeIf { it.isNotEmpty()}

        ?:""

    set(value) {

field = value

notifyPropertyChanged(BR.capacity)

}

======================================================================================

2. @Bindable 在java中

@Bindable

public StringgetName() {

return mName;

}

public void setName(String name) {

this.mName = name;

}

======================================================================================

3. @Bindable 在Kotlin中

a. 

var isAlertsImmediatelyEnable: Boolean

@Bindable

    get() = PushDebugSPHelper.isNotificationsAlertsImmediatelyEnable()

set(isEnable) {

PushDebugSPHelper.setNotificationsAlertsImmediatelyEnable(isEnable)

notifyPropertyChanged(BR.alertsImmediatelyEnable)

}

b. 

@Bindable

lateinit var rsvpNoResponseTitle: String

相关文章

网友评论

      本文标题:@Bindable 和@get:Bindable

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