热门搜索 :
考研考公
您的当前位置:首页正文

阿里强大的 复杂布局 vlayout

来源:东饰资讯网

源码使用 :

finalRecyclerView recyclerView = (RecyclerView) findViewById(R.id.main_view);   //recycleview 

final VirtualLayoutManager layoutManager =new VirtualLayoutManager(this);  //关键的 lanoutmanager  

final DelegateAdapter delegateAdapter = new DelegateAdapter(layoutManager, true);  //管理适配器  用来管理多个条目各自的adapter 

recyclerView.setAdapter(delegateAdapter);

final List<DelegateAdapter.Adapter> adapters = new LinkedList<>();  

 adapters.add(new SubAdapter(this, new LinearLayoutHelper(), 1) {
....

delegateAdapter.setAdapters(adapters); //最后将各个条目的适配器添加到管理适配器中 
Top