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

Can domestic 4G chips withstand Qualcomm’s monopoly?

As the National Development and Reform Commission ...

Learn about APP message push in ten minutes

Many friends have asked me how I write articles. ...

Profit as soon as you buy it: iPhone 13 depreciates 50% lower than iPhone 12

According to the latest report from SellCell (Int...

It is difficult to root Android 4.4.3/4.5

In January this year, Chainfire, a well-known deve...

How do Qianchuan video delivery and direct live broadcast rooms cooperate?

How to get Qianchuan search traffic bonus? How do...

How to choose Weibo advertising? I bet you know too little...

As we all know, when advertisers want to place ad...

Why do most programmers' side projects die?

[[145115]] We all have those side projects that e...

Offline traffic generation skills, a set of effective solutions!

As an offline merchant, what methods have you tri...

Rumor has it that Alibaba will swallow up Sina and take over Weibo

[[155128]] According to a person close to Alibaba...

Hong Kong version iPhone 6 briefly activated in Zhongguancun store

Faced with the rise of e-commerce companies such ...

15 essential data analysis methods for operations

When it comes to data analysis , people often thi...

App Increment and Retargeting: User Segmentation

For a long time, or at least since advertising be...