Search in sources :

Example 1 with SpaceItemDecoration

use of com.d.xrecyclerviewf.adapter.SpaceItemDecoration in project xRecyclerViewF by Dsiner.

the class ItemTouchRvActivity method setLayoutManager.

private void setLayoutManager() {
    if (isllayoutManager) {
        //网格布局
        if (itemDecoration == null) {
            itemDecoration = new SpaceItemDecoration(10);
        }
        recyclerView.addItemDecoration(itemDecoration);
        recyclerView.setLayoutManager(new GridLayoutManager(this, 4));
    } else {
        //线性布局
        recyclerView.removeItemDecoration(itemDecoration);
        recyclerView.setLayoutManager(new LinearLayoutManager(this));
    }
    isllayoutManager = !isllayoutManager;
}
Also used : SpaceItemDecoration(com.d.xrecyclerviewf.adapter.SpaceItemDecoration) GridLayoutManager(android.support.v7.widget.GridLayoutManager) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

Aggregations

GridLayoutManager (android.support.v7.widget.GridLayoutManager)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 SpaceItemDecoration (com.d.xrecyclerviewf.adapter.SpaceItemDecoration)1