मैं "संग्रह करने के लिए स्वाइप" के रूप में एक ही Gmail एप्लिकेशन हटाने के लिए स्वाइप लागू करने के लिए कोशिश कर रहा हूँ नष्ट करने के लिए:एंड्रॉयड - स्वाइप RecyclerView
मैं कई ट्यूटोरियल की कोशिश की है लेकिन उनमें से कोई रूप में काम करता जीमेल के रूप में तेज़, मैं बाहरी पुस्तकालय पर काम नहीं करना पसंद करता हूं। मैं यह कैसे कर सकता हूं?
संपादित करें:
मेरे कोड तो far-
ItemTouchHelper.SimpleCallback simpleItemTouchCallback = new ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT) {
public boolean onMove(RecyclerView recyclerView,
RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder target) {
// final int fromPos = viewHolder.getAdapterPosition();
// final int toPos = viewHolder.getAdapterPosition();
// // move item in `fromPos` to `toPos` in adapter.
return true;// true if moved, false otherwise
}
@Override
public void onSwiped(RecyclerView.ViewHolder viewHolder, int swipeDir) {
//Remove swiped item from list and notify the RecyclerView
mAdapter.notifyItemRemoved(viewHolder.getLayoutPosition());
}
};
ItemTouchHelper itemTouchHelper = new ItemTouchHelper(simpleItemTouchCallback);
itemTouchHelper.attachToRecyclerView(mRecyclerView);
मैं कड़ी चोट इशारा सक्षम करने के लिए प्रबंधित किया है लेकिन मैं एक पृष्ठभूमि और के तहत एक छवि को जोड़ने के लिए पता नहीं कैसे व्यूहोल्डर। मैंने item_XXX.xml फ़ाइल पर एक और फ्रेमलाउट डालने का प्रयास किया लेकिन स्वाइप पर यह पूरे आइटम को पृष्ठभूमि के साथ फेंक देता है।
यह मदद मिलेगी क्लिक करें: - http://stackoverflow.com/questions/27293960/swipe-to-dismiss -for-recyclerview – Wizard
आपको यह बताना चाहिए कि आपने अभी तक क्या किया है और आपने किस कोड की कोशिश की है। –
एक नज़र डालें http://stackoverflow.com/questions/30820806/adding-a-colored-background-with-text-icon-under-swiped-row-when-using-androids ,ChildDraw पर ओवरराइडिंग का उपयोग करके एक समाधान है। –