Android开发之PagerAdapter

 public class ViewPagerAdapter extends PagerAdapter {

     private List<View> views;
private Context context; public ViewPagerAdapter(List<View> views,Context context){
this.views = views;
this.context = context;
} @Override
public void destroyItem(View container, int position, Object object) {
// TODO Auto-generated method stub
((ViewPager) container).removeView(views.get(position));
} @Override
public Object instantiateItem(View container, int position) {
// TODO Auto-generated method stub
((ViewPager) container).addView(views.get(position));
return views.get(position);
} @Override
public int getCount() {
// TODO Auto-generated method stub
return views.size();
} @Override
public boolean isViewFromObject(View arg0, Object arg1) {
// TODO Auto-generated method stub
return arg0 == arg1;
} }
上一篇:iOS界面跳转的一些优化方案


下一篇:React是什么,为什么要使用它?