ScrollView嵌套ListView, WebView等带滚动条的.

@Override
	public boolean onTouch(View v, MotionEvent event) {
		// TODO Auto-generated method stub
		int mLastY = nm_sv.getScrollY();
		int msy = mail_info_wv.getScrollY();
		if (v.getId() == R.id.mail_info_wv) {

			/** super scroll not bottom || */
			if (mail_info_wv.getContentHeight() <= mail_info_wv.getHeight()
					|| mLastY != (ll.getHeight() - nm_sv.getHeight())) {
				nm_sv.requestDisallowInterceptTouchEvent(false);
				return false;
			}

			if (msy <= 0 && cLastY - msy > 0) {
				nm_sv.requestDisallowInterceptTouchEvent(false);
				return false;
			}

			nm_sv.requestDisallowInterceptTouchEvent(true);
			cLastY = msy;
		} else if (v.getId() == R.id.nm_sv) {
			if (mLastY == (ll.getHeight() - nm_sv.getHeight())) {
				nm_sv.requestDisallowInterceptTouchEvent(true);
				cLastY = msy;
				return false;
			}

			nm_sv.requestDisallowInterceptTouchEvent(false);
		}
		return false;
	}

猜你喜欢

转载自a29680270.iteye.com/blog/1632844