android recylcerView應用drag swipe

建立ItemTouchHelper
並設定
itemTouchHelper.attachToRecyclerView(recyclerView);


ItemTouchHelper itemTouchHelper1 = new ItemTouchHelper(new ItemTouchHelper.SimpleCallback() {
@Override
public boolean onMove(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder, @NonNull RecyclerView.ViewHolder viewHolder1) {
return false;
}
@Override
public void onSwiped(@NonNull RecyclerView.ViewHolder viewHolder, int i) {
}
@Override
public void onSelectedChanged(@Nullable RecyclerView.ViewHolder viewHolder, int actionState) {
super.onSelectedChanged(viewHolder, actionState);
}
@Override
public void clearView(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder) {
super.clearView(recyclerView, viewHolder);
}
});

留言

這個網誌中的熱門文章

android service作法

android app之間使用socket做溝通

html css & bootstrap心得