QQ-like side-slide deletion

QQ-like side-slide deletion

Source code introduction

Imitate QQ side sliding deletion, you can learn it if you need it
Source code screenshot

Source code snippet:

  1. Width = getWidth();
  2. list = getList();
  3. swipe = (SwipeListView) findViewById(R.id.example_lv_list);
  4. swipelist = new SwipeList(MainActivity. this , swipe, list);
  5. swipe.setAdapter(swipelist);
  6. swipe.setSwipeListViewListener( new BaseSwipeListViewListener(){
  7.   
  8. @Override  
  9. public   void onClickFrontView( int position) {
  10. // TODO Auto-generated method stub  
  11. super .onClickFrontView(position);
  12. }
  13.   
  14. @Override  
  15. public   void onDismiss( int [] reverseSortedPositions) {
  16. // TODO Auto-generated method stub  
  17. super .onDismiss(reverseSortedPositions);
  18. for ( int position:reverseSortedPositions){
  19. list.remove(position);
  20. }
  21. swipelist.notifyDataSetChanged();
  22. }
  23.   
  24.           
  25. @Override     public   void onListChanged() {
  26. // TODO Auto-generated method stub  
  27. super .onListChanged();
  28. }
  29. });
  30.           
  31. show();
  32. }
  33.       
  34.       
  35.       
  36. private   void show(){
  37. swipe.setSwipeMode(SwipeListView.SWIPE_MODE_LEFT);
  38. swipe.setSwipeActionLeft(SwipeListView.SWIPE_ACTION_REVEAL);
  39. swipe.setOffsetLeft(Width* 1 / 5 );
  40. swipe.setAnimationTime( 0 );
  41. swipe.setSwipeOpenOnLongPress( false );
  42. }
  43.       
  44. private List<img> getList(){
  45. List<img> mlist = new ArrayList<img>();
  46. for ( int i= 0 ;i<numbers.length;i++){ image= "" image();= "" image.setimage(numbers[i]);= "" image.settext(i+ "" );= "" image.setname((i+ 1 )+ "" );= "" mlist.add(image);= "" }= ""   return = "" mlist;= ""   private = ""   int = "" getwidth(){= "" getresources().getdisplaymetrics().widthpixels;= "" }<= "" pre= "" >
  47. </numbers.length;i++){>

Source code link: http://download..com/data/2013976

<<:  The "Green Onion Entrepreneurship Plan" is officially launched and entrepreneurs can receive high-quality resource support

>>:  Developers can now submit Apple Watch apps

Recommend

What does glass that can regulate sunlight look like?

Produced by: Science Popularization China Produce...

Where is the "hometown" of bayberry? A genuine "Chinese fruit"

This summer, bayberry, a fruit produced in abunda...

Three amazing technical experts I met during my programming career

I have been programming for more than ten years w...

Umeng: 5 tips to increase user activity through in-app communities

To what extent can the community influence the us...

App promotion and application insight report!

According to our data monitoring of the mobile ap...

Zhihu product operation analysis

From a vertical knowledge community loved by prof...

iPhone finally supports third-party apps? iOS 14.7 Beta 5 leaks

Recently, Apple officially pushed the iOS 14.7 an...

Is low-carbon investment worth looking forward to?

The oil and gas landscape is changing. The indust...

Being afraid of thunder is not a sign of being timid.

Audit expert: Yin Tielun Deputy Chief Physician, ...

There is a Longquanyi in Chengdu

When it comes to sightseeing in Chengdu, Longquan...

Game live streaming platform: Douyu, Huya competitive product analysis report

In this article, the author attempts to analyze t...

Private domain traffic activity promotion process

This is a project I worked on in my previous comp...