本文整理了Java中android.webkit.WebView.onInterceptTouchEvent()
方法的一些代码示例,展示了WebView.onInterceptTouchEvent()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebView.onInterceptTouchEvent()
方法的具体详情如下:
包路径:android.webkit.WebView
类名称:WebView
方法名:onInterceptTouchEvent
暂无
代码示例来源:origin: ksoichiro/Android-ObservableScrollView
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
if (hasNoCallbacks()) {
return super.onInterceptTouchEvent(ev);
}
switch (ev.getActionMasked()) {
case MotionEvent.ACTION_DOWN:
// Whether or not motion events are consumed by children,
// flag initializations which are related to ACTION_DOWN events should be executed.
// Because if the ACTION_DOWN is consumed by children and only ACTION_MOVEs are
// passed to parent (this view), the flags will be invalid.
// Also, applications might implement initialization codes to onDownMotionEvent,
// so call it here.
mFirstScroll = mDragging = true;
dispatchOnDownMotionEvent();
break;
}
return super.onInterceptTouchEvent(ev);
}
代码示例来源:origin: xmuSistone/VerticalSlideFragment
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
if (ev.getAction() == MotionEvent.ACTION_DOWN) {
downX = ev.getRawX();
downY = ev.getRawY();
isAtTop = isAtTop();
scrollMode = MODE_IDLE;
getParent().requestDisallowInterceptTouchEvent(true);
} else if (ev.getAction() == MotionEvent.ACTION_MOVE) {
if (scrollMode == MODE_IDLE) {
float xDistance = Math.abs(downX - ev.getRawX());
float yDistance = Math.abs(downY - ev.getRawY());
if (xDistance > yDistance && xDistance > mTouchSlop) {
scrollMode = MODE_HORIZONTAL;
} else if (yDistance > xDistance && yDistance > mTouchSlop) {
scrollMode = MODE_VERTICAL;
if (downY < ev.getRawY() && isAtTop) {
getParent().requestDisallowInterceptTouchEvent(false);
}
}
}
}
return super.onInterceptTouchEvent(ev);
}
代码示例来源:origin: com.albedinsky.android/ui
/**
*/
@Override
public boolean onInterceptTouchEvent(@NonNull MotionEvent event) {
this.ensureDecorator();
return mDecorator.onInterceptTouchEvent(event) || super.onInterceptTouchEvent(event);
}
代码示例来源:origin: com.willowtreeapps/oak-parentswipingviews
@Override
public boolean onInterceptTouchEvent(MotionEvent event) {
final int action = event.getAction();
if (action == MotionEvent.ACTION_DOWN) {
mCurrX = event.getX();
mCurrY = event.getY();
getParent().requestDisallowInterceptTouchEvent(true);
} else if (action == MotionEvent.ACTION_MOVE) {
// Shouldn't need to do anything
} else if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL) {
getParent().requestDisallowInterceptTouchEvent(false);
} else {
getParent().requestDisallowInterceptTouchEvent(true);
}
return super.onInterceptTouchEvent(event);
}
内容来源于网络,如有侵权,请联系作者删除!