use of com.litingzhe.justandroid.ui.listandGridView.recyleItemTouchHandler.MyItemTouchHandler in project JustAndroid by chinaltz.
the class DragRecyleViewActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_single_recyclerview);
ButterKnife.bind(this);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayShowTitleEnabled(false);
navToolBarBack.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
toolbarTitle.setText("可拖拽的RecyleView");
for (int i = 0; i < 50; i++) {
str.add("data: " + i);
}
recyclerView.setLayoutManager(new GridLayoutManager(this, 4, GridLayoutManager.VERTICAL, false));
myAdapter = new MyAdapter();
recyclerView.setAdapter(myAdapter);
new ItemTouchHelper(new MyItemTouchHandler(myAdapter)).attachToRecyclerView(recyclerView);
}
Aggregations