How to remove items from a list with swipe gesture like in gmail [duplicate]

二次信任 提交于 2019-12-03 09:53:53

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!