标签:
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 }
标签:
原文地址:http://www.cnblogs.com/liyiran/p/4654435.html