use of com.d.lib.xrv.itemtouchhelper.SimpleItemTouchHelperCallback in project xRecyclerViewF by Dsiner.
the class ItemTouchRvActivity method init.
private void init() {
//step9-1:获取引用-!!!!!!!!!!不要使用XRecyclerView
recyclerView = (RecyclerView) this.findViewById(R.id.rv_list);
recyclerView.setHasFixedSize(true);
//step9-2:为RecyclerView指定布局管理对象
setLayoutManager();
//step9-3:setAdapter
ItemTouchAdapter adapter = new ItemTouchAdapter(this, datas, R.layout.item_touch);
adapter.setOnStartDragListener(this);
recyclerView.setAdapter(adapter);
//step9-4:关联ItemTouchHelper
ItemTouchHelper.Callback callback = new SimpleItemTouchHelperCallback(adapter);
itemTouchHelper = new ItemTouchHelper(callback);
//!!!!!!!!!!不要使用XRecyclerView-重要的事情说三遍
itemTouchHelper.attachToRecyclerView(recyclerView);
}
Aggregations