AB_ BindingToCollection

AB 支持綁定 Collection spa

public class ArrayListObservable<T> extends ObservableCollection<T> implements Collection<T>

示例:code

The constructor is pretty much similar to simple observable properties, notice you must pass the class of the generic type to it (just like observables).

public ArrayListObservable<String> NameOfList = 
                        new ArrayListObservable<String>(String.class);
With above declaration, you can do something like:

NameOfList.setArray(new String[] { ... });
NameOfList.add("abc");
//etc
just like normal ArrayList, and if you bind it to itemSource of ListViews or Spinners, the change on the list will be reflected to the view directly.
相關文章
相關標籤/搜索