ViewPager向右滑动到最后,再向右滑动实现界面跳转

转载地址http://www.drovik.com/html/8632572718.html


 关键代码

  重写activity的onTouch事件|||||||上面链接有demo

@Override
	public boolean onTouch(View v, MotionEvent event) {
		switch (event.getAction()) {
		case MotionEvent.ACTION_DOWN:
			lastX = (int)event.getX();
			break;
		case MotionEvent.ACTION_MOVE:
			if((lastX - event.getX()) >100 && (currentIndex == views.size() -1)){
				Toast.makeText(this, "在此处添加界面跳转代码哦!", Toast.LENGTH_LONG).show();
				this.finish();
			}
			break;
		default:
			break;
		}
		return false;
	}


你可能感兴趣的:(ViewPager向右滑动到最后,再向右滑动实现界面跳转)