问题
Possible Duplicate:
android swipe to delete list row
I want to implement a list of items and on swiping left->right the item should be remove, like a Gmail. Has Android some native Elements to develop such list?
回答1:
No native api direct from android, but here is third level api "drag-sort-listview" that extendes the default listview
https://github.com/bauerca/drag-sort-listview
and the api has a remove option on swipe gesture.
回答2:
Roman Nurik posted some beta code implementing this feature a couple of months ago. Caveat is that it's only compatible for ICS+ devices. Fortunately, Jake Wharton backported the code soon after publication, using the NineOldAndroids library.
- BETA Android 4.0-style "Swipe to Dismiss" sample code
- Backport of Roman Nurik's "Swipe-to-dismiss" sample code using NineOldAndroids to work on all API levels
The latter provides a sample APK too, in case you feel like having a play with the result first.
回答3:
There is no native code to do that. However, you can check Roman Nurik's sample code here. Google Plus post here
来源:https://stackoverflow.com/questions/14129005/how-to-remove-items-from-a-list-with-swipe-gesture-like-in-gmail