Most visited

Recently visited

ObservableField

public class ObservableField
extends BaseObservable implements Serializable

java.lang.Object
   ↳ android.databinding.BaseObservable
     ↳ android.databinding.ObservableField<T>
Known Direct Subclasses


一个对象包装,使其可观察。

可以使用Observable字段类来代替创建Observable对象:

public class MyDataObject {
     public final ObservableField<String> name = new ObservableField<String>();
     public final ObservableInt age = new ObservableInt();
 }
Fields of this type should be declared final because bindings only detect changes in the field's value, not of the field itself.

也可以看看:

Summary

Public constructors

ObservableField(T value)

包装给定的对象并创建一个可观察的对象

ObservableField()

创建一个空的可观察对象

Public methods

T get()
void set(T value)

设置存储的值。

Inherited methods

From class android.databinding.BaseObservable
From class java.lang.Object
From interface android.databinding.Observable

Public constructors

ObservableField

ObservableField (T value)

包装给定的对象并创建一个可观察的对象

Parameters
value T: The value to be wrapped as an observable.

ObservableField

ObservableField ()

创建一个空的可观察对象

Public methods

get

T get ()

Returns
T the stored value.

set

void set (T value)

设置存储的值。

Parameters
value T

Hooray!