源码片段
public class MainPagerAdapter extends PagerAdapter {
private List<view> pageViews;
public MainPagerAdapter(List<view> pageViews) {
this.pageViews = pageViews;
}
@Override
public int getCount() {
// TODO Auto-generated method stub
return pageViews.size();
}
@Override
public boolean isViewFromObject(View arg0, Object arg1) {
// TODO Auto-generated method stub
return arg0 == arg1;
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
// TODO Auto-generated method stub
container.removeView(pageViews.get(position));
}
@Override
public int getItemPosition(Object object) {
// TODO Auto-generated method stub
return super.getItemPosition(object);
}
@Override
public Object instantiateItem(ViewGroup container, final int position) {
// TODO Auto-generated method stub
container.addView(pageViews.get(position));
return pageViews.get(position);
}
@Override
public void finishUpdate(ViewGroup container) {
// TODO Auto-generated method stub
super.finishUpdate(container);
}
@Override
public void restoreState(Parcelable state, ClassLoader loader) {
// TODO Auto-generated method stub
super.restoreState(state, loader);
}
@Override
public Parcelable saveState() {
// TODO Auto-generated method stub
return super.saveState();
}
@Override
public void startUpdate(ViewGroup container) {
// TODO Auto-generated method stub
super.startUpdate(container); </view></view>