Search in sources :

Example 1 with Adapter

use of com.alibaba.android.vlayout.DelegateAdapter.Adapter in project vlayout by alibaba.

the class DebugActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main_activity);
    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.main_view);
    VirtualLayoutManager virtualLayoutManager = new VirtualLayoutManager(this);
    DelegateAdapter delegateAdapter = new DelegateAdapter(virtualLayoutManager);
    List<Adapter> adapterList = new ArrayList<>();
    adapterList.add(new SubAdapter(new LinearLayoutHelper(20), 20));
    adapterList.add(new SubAdapter(new StickyLayoutHelper(true), 1));
    adapterList.add(new SubAdapter(new LinearLayoutHelper(20), 20));
    adapterList.add(new SubAdapter(new GridLayoutHelper(4), 80));
    // adapterList.add(new SubAdapter(new FixLayoutHelper(0, 0), 1));
    adapterList.add(new SubAdapter(new FixLayoutHelper(TOP_RIGHT, 0, 0), 1));
    delegateAdapter.addAdapters(adapterList);
    recyclerView.setLayoutManager(virtualLayoutManager);
    recyclerView.setAdapter(delegateAdapter);
}
Also used : DelegateAdapter(com.alibaba.android.vlayout.DelegateAdapter) LinearLayoutHelper(com.alibaba.android.vlayout.layout.LinearLayoutHelper) StickyLayoutHelper(com.alibaba.android.vlayout.layout.StickyLayoutHelper) ArrayList(java.util.ArrayList) FixLayoutHelper(com.alibaba.android.vlayout.layout.FixLayoutHelper) RecyclerView(android.support.v7.widget.RecyclerView) Adapter(com.alibaba.android.vlayout.DelegateAdapter.Adapter) DelegateAdapter(com.alibaba.android.vlayout.DelegateAdapter) VirtualLayoutManager(com.alibaba.android.vlayout.VirtualLayoutManager) GridLayoutHelper(com.alibaba.android.vlayout.layout.GridLayoutHelper)

Aggregations

RecyclerView (android.support.v7.widget.RecyclerView)1 DelegateAdapter (com.alibaba.android.vlayout.DelegateAdapter)1 Adapter (com.alibaba.android.vlayout.DelegateAdapter.Adapter)1 VirtualLayoutManager (com.alibaba.android.vlayout.VirtualLayoutManager)1 FixLayoutHelper (com.alibaba.android.vlayout.layout.FixLayoutHelper)1 GridLayoutHelper (com.alibaba.android.vlayout.layout.GridLayoutHelper)1 LinearLayoutHelper (com.alibaba.android.vlayout.layout.LinearLayoutHelper)1 StickyLayoutHelper (com.alibaba.android.vlayout.layout.StickyLayoutHelper)1 ArrayList (java.util.ArrayList)1