每当我在我的应用程序中滑动视图寻呼机时。页面将更新为 0,0,1,2,3,4 而不是 0,1,2,3,4,5。每当我前后滑动视图时随机更新。这是我的代码。我跟踪了 pager.getcurrentitem()。但它工作正常...找不到错误。请帮助我。
@Override
public Object instantiateItem(View paramView, final int paramInt) {
View localView = this.inflater.inflate(R.layout.item_pager,null
);
ViewHolder holder= new ViewHolder();
holder. imageView = (ImageView) localView.findViewById(R.id.imageView1);
Toast.makeText(getApplicationContext(), ""+pager.getCurrentItem(), Toast.LENGTH_SHORT).show();
Picasso.with(getApplicationContext()) //
.load(images[pager.getCurrentItem()]) //
.placeholder(R.drawable.ic_launcher) //
.error(R.drawable.ic_launcher) //
.fit() //
.into(holder.imageView);
localView.setTag(holder);
((ViewPager) paramView).addView(localView,0);
return localView;