我要禁用刷卡,但只有右侧。我发现这的答案。遗憾的是,这份全 ViewPager
源要达到的目标。有刚继承现有类,而不是复制的任何方法?
I want to disable the swiping, but only to the right side. I found a working solution in this answer. Unfortunately, this copies the whole ViewPager
source to achieve the goal. Is there any methods just inheriting the existing class and not duplicating?
我不知道这正是你需要: 我需要一个viewpager为与最大页面向导,用户无法通过。
I'm not sure this is exactly what you need: I needed a viewpager for a wizard with a max page that the user can't pass it.
目前终了时,溶液是在适配器。 我改变了PagerAdapter的数量,这种方式阻止用户从通过最大页面:
At the end the solution was in the adapter. I changed the count of the PagerAdapter and this way blocks the user from passing the max page:
@Override
public int getCount() {
return mProgress; //max page + 1
}
当用户前进到下一个页面:
When the user progresses to the next page:
private void setWizardProgress(int progress) {
if(progress > mProgress) {
mProgress = progress;
mWizardPagerAdapter.notifyDataSetChanged();
}
}
这样当用户在最大页,他不能滚动到右侧。
This way when the user is at max page he can't scroll to the right.