AB_ BindingToCollection

AB 支持绑定 Collection 

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

示例:

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.

 

posted @ 2013-09-04 11:05  pinotao  阅读(154)  评论(0编辑  收藏  举报