下面是我的instanceitem方法
@Override
public Object instantiateItem(ViewGroup container, int position) {
View itemView = mLayoutInflater.inflate(R.layout.pager_item, container, false);
ImageView imageView = (ImageView) itemView.findViewById(R.id.img);
TextView textView = (TextView) itemView.findViewById(R.id.txt);
imageView.setImageResource(mResources[position]);
textView.setText(mCompanies[position]);
container.addView(itemView);
return itemView;
}
我想通过滚动来检测用户是否已经到达视图寻呼机的末端,如果用户已经到达末端,我想从左到右摇动整个视图寻呼机。我该怎么做?
最佳答案
@Override
public void onPageScrollStateChanged(int state) {
//mImageResource is image array
if(state<mImageResources.length)
{
//intro_images is viewpager
intro_images.setCurrentItem(0,true);
}
}
关于android - 到达查看结束时将查看页面移至第一项,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/36083407/