BeanAdapter是以List<Object>为适配来源的adapter。List<Object>对adapter解决自定义对象的线性填充。
demo:List trips = new ArrayList();trips.add(trip1);trips.add(trip2);trips.add(trip3);BeanAdapter beanAdapter = new BeanAdapter()//准备对应的object 字段.buildNames("name","desc","positionRef","shareSuggestion","district","url")//准备和上面字段对应的填充id.buildViewId(R.id.name,R.id.desc,R.id.positionref,R.id.sharesuggestion,R.id.district,R.id.image)//完成配对,注意字段不要拼错,然后设置id群所在的item布局.buildItemLayout(R.layout.item_layout)//最后一步配置view和value 在内部配对的converter,保证值解入view,可自定义设定.buildConverter(new DefaultValueViewConverter()).build(trips);adapterView.setAdapter(beanAdapter);点击空白处退出提示
评论