码迷,mamicode.com
首页 > 移动开发 > 详细

Android开发之PagerAdapter

时间:2015-07-17 15:32:44      阅读:125      评论:0      收藏:0      [点我收藏+]

标签:

 1 public class ViewPagerAdapter extends PagerAdapter {
 2     
 3     private List<View> views;
 4     private Context context;
 5     
 6     public ViewPagerAdapter(List<View> views,Context context){
 7         this.views = views;
 8         this.context = context;
 9     }
10     
11     @Override
12     public void destroyItem(View container, int position, Object object) {
13         // TODO Auto-generated method stub
14         ((ViewPager) container).removeView(views.get(position));
15     }
16     
17     @Override
18     public Object instantiateItem(View container, int position) {
19         // TODO Auto-generated method stub
20         ((ViewPager) container).addView(views.get(position));
21         return views.get(position);
22     }
23 
24     @Override
25     public int getCount() {
26         // TODO Auto-generated method stub
27         return views.size();
28     }
29 
30     @Override
31     public boolean isViewFromObject(View arg0, Object arg1) {
32         // TODO Auto-generated method stub
33         return arg0 == arg1;
34     }
35 
36 }

 

Android开发之PagerAdapter

标签:

原文地址:http://www.cnblogs.com/liyiran/p/4654435.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!