仿QQ侧滑删除

移动开发
模仿QQ侧滑删除,需要的可以学习下

源码简介

 

模仿QQ侧滑删除,需要的可以学习下
源码截图

源码片段:

  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++){> 

源码链接:http://down.51cto.com/data/2013976

 

责任编辑:chenqingxiang 来源: 网络整理
相关推荐

2015-07-20 15:14:19

侧滑菜单功能多样

2021-03-01 14:01:41

鸿蒙HarmonyOS应用开发

2015-09-07 10:57:38

qq未读消息

2012-04-02 22:20:49

苹果

2014-12-15 09:53:55

Android侧滑菜单SlidingMenu

2015-09-09 11:08:48

qq空间可拉伸头部

2015-08-07 15:32:19

欢迎界面仿微信仿qq空间

2021-11-24 10:02:53

鸿蒙HarmonyOS应用

2012-04-02 19:32:11

iPhone 4

2015-01-19 12:19:04

iOS源码ActionSheet仿QQ音乐

2017-05-03 16:30:38

AndroidScrollView滚动视图

2020-07-13 08:45:14

亚马逊TikTok移动设备

2021-04-15 17:47:38

鸿蒙HarmonyOS应用

2012-12-25 13:16:56

AndroidQQ2012UI

2013-09-02 15:04:25

QQ高仿版GG叽叽

2017-09-05 15:57:47

2015-07-31 11:29:25

锤子时钟

2015-10-20 16:01:47

华为商城源码android

2015-12-09 11:07:16

商城源码android
点赞
收藏

51CTO技术栈公众号