हां वहाँ है। ItemTouchHelper का प्रयोग करें। this project क्लोन करने का प्रयास करें और देखें कि इसका उपयोग कैसे किया जाता है।
ItemTouchHelper.SimpleCallback simpleCallback =
new ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.RIGHT) {
@Override
public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder,
RecyclerView.ViewHolder target) {
return false;
}
@Override
public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) {
//do things
}
};
ItemTouchHelper itemTouchHelper = new ItemTouchHelper(simpleCallback);
itemTouchHelper.attachToRecyclerView(recyclerView);
recyclerView
चर होल्डिंग recycler दृश्य है:
विशिष्ट file के लिए, आलसी लोग हैं, जो लिंक पर क्लिक करने के लिए नहीं करना चाहते हैं के लिए लाइन 87
देखो, यह तुम कैसे सेटअप है।
ItemTouchHelper.RIGHT से अलग अन्य दिशाएं हैं, प्रयोग करने का प्रयास करें।
मैंने छोटी लाइब्रेरी बनाई है जो जेस्चर निर्माण को आसान बनाने के लिए आइटम टचहेल्पर का उपयोग करती है, आप इसे यहां github.com/olmur/rvtools –