本文整理了Java中android.webkit.WebView.onTouchEvent()
方法的一些代码示例,展示了WebView.onTouchEvent()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebView.onTouchEvent()
方法的具体详情如下:
包路径:android.webkit.WebView
类名称:WebView
方法名:onTouchEvent
暂无
代码示例来源:origin: pockethub/PocketHub
@Override
public boolean onTouchEvent(MotionEvent p_event) {
if (intercept && getParent() != null) {
getParent().requestDisallowInterceptTouchEvent(true);
}
return super.onTouchEvent(p_event);
}
代码示例来源:origin: ksoichiro/Android-ObservableScrollView
@Override
public boolean onTouchEvent(MotionEvent ev) {
if (hasNoCallbacks()) {
return super.onTouchEvent(ev);
return super.onTouchEvent(ev);
return super.onTouchEvent(ev);
代码示例来源:origin: xmuSistone/VerticalSlideFragment
@Override
public boolean onTouchEvent(MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
downX = event.getRawX();
downY = event.getRawY();
isAtTop = isAtTop();
scrollMode = MODE_IDLE;
getParent().requestDisallowInterceptTouchEvent(true);
} else if (event.getAction() == MotionEvent.ACTION_MOVE) {
if (scrollMode == MODE_IDLE) {
float xDistance = Math.abs(downX - event.getRawX());
float yDistance = Math.abs(downY - event.getRawY());
if (xDistance > yDistance && xDistance > mTouchSlop) {
scrollMode = MODE_HORIZONTAL;
} else if (yDistance > xDistance && yDistance > mTouchSlop) {
scrollMode = MODE_VERTICAL;
if (downY < event.getRawY() && isAtTop) {
getParent().requestDisallowInterceptTouchEvent(false);
}
}
}
}
return super.onTouchEvent(event);
}
代码示例来源:origin: appnexus/mobile-sdk-android
@Override
public boolean onTouchEvent(MotionEvent event) {
userInteracted = true;
return super.onTouchEvent(event);
}
代码示例来源:origin: xudjx/webprogress
@Override
public boolean onTouchEvent(MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
mTouchByUser = true;
break;
}
return super.onTouchEvent(event);
}
代码示例来源:origin: linxin6560/DetailScrollView
@Override
public boolean onTouchEvent(MotionEvent ev) {
if (mHelper == null)
return super.onTouchEvent(ev);
return mHelper.onTouchEvent(ev) && super.onTouchEvent(ev);
}
代码示例来源:origin: huntermr/FastAndroid
@Override
public boolean onTouchEvent(MotionEvent ev) {
super.onTouchEvent(ev);
if (mZoomButtonsController != null) {
// Hide the controlls AFTER they where made visible by the default implementation.
mZoomButtonsController.setVisible(false);
}
return true;
}
}
代码示例来源:origin: dailymotion/dailymotion-player-sdk-android
@Override
public boolean onTouchEvent(MotionEvent event) {
if (mDisallowIntercept) {
requestDisallowInterceptTouchEvent(true);
}
return super.onTouchEvent(event);
}
代码示例来源:origin: schaal/ocreader
@Override
public boolean onTouchEvent(MotionEvent event){
final boolean handled = gestureDetector.onTouchEvent(event);
if (!handled && event.getAction() == MotionEvent.ACTION_UP) {
stopNestedScroll();
}
return super.onTouchEvent(event);
}
代码示例来源:origin: calvinaquino/LNReader-Android
@Override
public boolean onTouchEvent(MotionEvent ev) {
// TODO: Error when exiting the current activity with zoom control shown.
// E/WindowManager(6797): android.view.WindowLeaked: Activity
// com.erakk.lnreader.UI.activity.DisplayImageActivity has leaked window
// android.widget.ZoomButtonsController$Container{41c709a0 V.E..... ........ 0,0-540,73} that was originally
// added here
super.onTouchEvent(ev);
try {
checkZoomEvent(ev);
} catch (IllegalArgumentException ex) {
Log.e(TAG, "Failed to handle zoom event.", ex);
}
return true;
}
代码示例来源:origin: stackoverflow.com
WebView wv = new WebView(this);
View dummyView = new Button(this);
dummyView.setBackgroundColor(0x00000000);
dummyView.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_UP) {
MotionEvent down = MotionEvent.obtain(100, 100,
MotionEvent.ACTION_DOWN, event.getX(),
event.getY(), 0);
wv.onTouchEvent(down);
wv.onTouchEvent(event);
}
return false;
}
});
FrameLayout fl = new FrameLayout(this);
fl.addView(wv);
fl.addView(dummyView);
topLayout.addView(fl);
代码示例来源:origin: com.albedinsky.android/ui
/**
*/
@Override
public boolean onTouchEvent(@NonNull MotionEvent event) {
this.ensureDecorator();
return mDecorator.onTouchEvent(event) || super.onTouchEvent(event);
}
代码示例来源:origin: adrielcafe/AndroidOAuth
@Override
public boolean onTouchEvent(MotionEvent ev) {
switch (ev.getAction()) {
case MotionEvent.ACTION_DOWN:
case MotionEvent.ACTION_UP:
if (!hasFocus()) {
requestFocus();
}
break;
}
return super.onTouchEvent(ev);
}
}
代码示例来源:origin: wutq/AndroidModuleDemo
@SuppressLint("ClickableViewAccessibility")
@Override
public boolean onTouchEvent(MotionEvent ev) {
switch (ev.getAction()) {
case MotionEvent.ACTION_MOVE:
float Y = ev.getY();
float Ys = Y - oldY;
//滑动到顶部让父控件重新获得触摸事件
if (Ys > 0 && t == 0) {
getParent().getParent().requestDisallowInterceptTouchEvent(false);
}
break;
case MotionEvent.ACTION_DOWN:
getParent().getParent().requestDisallowInterceptTouchEvent(true);
oldY = ev.getY();
break;
case MotionEvent.ACTION_UP:
getParent().getParent().requestDisallowInterceptTouchEvent(true);
break;
default:
break;
}
return super.onTouchEvent(ev);
}
代码示例来源:origin: WelliJohn/StickScrollView
@Override
public boolean onTouchEvent(MotionEvent event) {
if (mScrollViewWithStickHeader == null) return super.onTouchEvent(event);
int action = event.getAction();
return super.onTouchEvent(event);
} else {
if (Math.abs(event.getX() - mLastX) < minPageSlop) {
getParent().requestDisallowInterceptTouchEvent(false);
return super.onTouchEvent(event);
} else {
getParent().requestDisallowInterceptTouchEvent(false);
if (Math.abs(event.getX() - mLastX) < minPageSlop) {
getParent().requestDisallowInterceptTouchEvent(true);
return super.onTouchEvent(event);
} else {
getParent().requestDisallowInterceptTouchEvent(true);
if (Math.abs(event.getX() - mLastX) < minPageSlop) {
getParent().requestDisallowInterceptTouchEvent(true);
return super.onTouchEvent(event);
} else {
getParent().requestDisallowInterceptTouchEvent(true);
return super.onTouchEvent(event);
代码示例来源:origin: mengzhidaren/RecylerViewMultiHeaderView
return super.onTouchEvent(event);
代码示例来源:origin: BolexLiu/ApkBusBlog
mNestedOffsetY += mScrollOffset[1];
returnValue = super.onTouchEvent(event);
returnValue = super.onTouchEvent(event);
mLastY = eventY;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
returnValue = super.onTouchEvent(event);
代码示例来源:origin: jtmcn/archwiki-viewer
mNestedOffsetY += mScrollOffset[1];
returnValue = super.onTouchEvent(event);
returnValue = super.onTouchEvent(event);
mLastY = eventY;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
returnValue = super.onTouchEvent(event);
代码示例来源:origin: vic797/prowebview
nestedOffsetY += scrollOffset[1];
returnValue = super.onTouchEvent(event);
if (dispatchNestedScroll(0, scrollOffset[1], 0, deltaY, scrollOffset)) {
event.offsetLocation(0, scrollOffset[1]);
returnValue = super.onTouchEvent(event);
lastY = eventY;
startNestedScroll(ViewCompat.SCROLL_AXIS_VERTICAL);
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
returnValue = super.onTouchEvent(event);
stopNestedScroll();
break;
代码示例来源:origin: tcoxon/XkcdViewer
boolean consumed = super.onTouchEvent(evt);
内容来源于网络,如有侵权,请联系作者删除!