android.widget.ScrollView.onInterceptTouchEvent()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(182)

本文整理了Java中android.widget.ScrollView.onInterceptTouchEvent()方法的一些代码示例,展示了ScrollView.onInterceptTouchEvent()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ScrollView.onInterceptTouchEvent()方法的具体详情如下:
包路径:android.widget.ScrollView
类名称:ScrollView
方法名:onInterceptTouchEvent

ScrollView.onInterceptTouchEvent介绍

暂无

代码示例

代码示例来源:origin: janishar/PlaceHolderView

@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
  if (!scrollable) return false;
  return super.onInterceptTouchEvent(ev);
}

代码示例来源:origin: gzu-liyujiang/AndroidPicker

@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
  return super.onInterceptTouchEvent(ev)
      && mGestureDetector.onTouchEvent(ev);
}

代码示例来源:origin: smuyyh/BookReader

@Override
  public boolean onInterceptTouchEvent(MotionEvent e) {
    int action = e.getAction();
    switch (action) {
      case MotionEvent.ACTION_DOWN:
        downX = (int) e.getRawX();
        downY = (int) e.getRawY();
        break;
      case MotionEvent.ACTION_MOVE:
        int moveY = (int) e.getRawY();
        if (Math.abs(moveY - downY) > mTouchSlop) {
          return true;
        }
    }
    return super.onInterceptTouchEvent(e);
  }
}

代码示例来源: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: k9mail/k-9

@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
  final int action = getActionMasked(ev);
  final boolean isUp = action == MotionEvent.ACTION_UP;
  if (isUp && mInCustomDrag) {
    // An up event after a drag should be intercepted so that child views don't handle
    // click events falsely after a drag.
    mInCustomDrag = false;
    onTouchEvent(ev);
    return true;
  }
  if (!mInCustomDrag && !isEventOverChild(ev, mChildrenNeedingAllTouches)) {
    return super.onInterceptTouchEvent(ev);
  }
  // Note the normal scrollview implementation is to intercept all touch events after it has
  // detected a drag starting. We will handle this ourselves.
  mInCustomDrag = super.onInterceptTouchEvent(ev);
  if (mInCustomDrag) {
    onTouchEvent(ev);
  }
  // Don't intercept events - pass them on to children as normal.
  return false;
}

代码示例来源:origin: wangdan/AisenWeiBo

return super.onInterceptTouchEvent(ev);

代码示例来源:origin: fossasia/pslab-android

@Override
public boolean onInterceptTouchEvent(MotionEvent event) {
  return super.onInterceptTouchEvent(event);
}

代码示例来源:origin: xmuSistone/VerticalSlideFragment

@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
  if (ev.getAction() == MotionEvent.ACTION_DOWN) {
    downY = ev.getRawY();
    isAtBottom = isAtBottom();
    scrollMode = TOUCH_IDLE;
    getParent().requestDisallowInterceptTouchEvent(true);
  } else if (ev.getAction() == MotionEvent.ACTION_MOVE) {
    if (scrollMode == TOUCH_IDLE) {
      float yOffset = downY - ev.getRawY();
      float yDistance = Math.abs(yOffset);
      if (yDistance > mTouchSlop) {
        if (yOffset > 0 && isAtBottom) {
          scrollMode = TOUCH_DRAG_LAYOUT;
          getParent().requestDisallowInterceptTouchEvent(false);
          return true;
        } else {
          scrollMode = TOUCH_INNER_CONSIME;
        }
      }
    }
  }
  return super.onInterceptTouchEvent(ev);
}

代码示例来源:origin: xiaoxiangyeyuHeaven/HeavenlyModule

@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
  // TODO Auto-generated method stub
  return super.onInterceptTouchEvent(ev);
}

代码示例来源:origin: envyfan/AndroidReview

@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
  return super.onInterceptTouchEvent(ev) && mGestureDetector.onTouchEvent(ev);
}

代码示例来源:origin: JmStefanAndroid/PVCloudGroupn

@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
  if (ev.getAction() == MotionEvent.ACTION_DOWN) {
    mTouchY = ev.getY();
  }
  return super.onInterceptTouchEvent(ev);
}

代码示例来源:origin: ImmortalZ/jellyball

@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
  if (ev.getAction() == MotionEvent.ACTION_DOWN) {
    mTouchDownY = ev.getY();
    mCurrentTop = mInitTop = mHeader.getTop();
    mCurrentBottom = mInitBottom = mHeader.getBottom();
    //LogUtil.m("mInitTop " + mInitTop + " mInitBottom " + mInitBottom);
  }
  return super.onInterceptTouchEvent(ev);
}

代码示例来源:origin: Tencent/RapidView

@Override
public boolean onInterceptTouchEvent(MotionEvent ev)
{
  boolean ret = false;
  if( mInterruptListener != null ){
    ret = mInterruptListener.onInterceptTouchEvent(ev);
  }
  if( ret ){
    return true;
  }
  return super.onInterceptTouchEvent(ev);
}

代码示例来源:origin: TUBB/SwipeMenu

@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
  boolean isIntercepted = super.onInterceptTouchEvent(ev);
  int action = ev.getActionMasked();
  switch (action) {
    case MotionEvent.ACTION_DOWN:
      isIntercepted = mHelper.handleListDownTouchEvent(ev, isIntercepted);
      break;
  }
  return isIntercepted;
}

代码示例来源:origin: quaap/LaunchTime

@Override
public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
  //Log.d(TAG, "onInterceptTouchEvent");
  boolean isLRSwipe = shouldSwipe(motionEvent);
  return isLRSwipe || super.onInterceptTouchEvent(motionEvent);
}

代码示例来源:origin: GeoODK/collect

@Override public boolean onInterceptTouchEvent(MotionEvent event)
  {
    boolean ret = super.onInterceptTouchEvent(event);
    ret = ret | sv.onInterceptTouchEvent(event);
    return ret;
  }
}

代码示例来源:origin: msdx/AndroidSnippet

@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
  return onTouchEvent(ev) && super.onInterceptTouchEvent(ev);
}

代码示例来源:origin: com.albedinsky.android/ui-widget-layout

/**
 */
@Override
public boolean onInterceptTouchEvent(@NonNull MotionEvent event) {
  this.ensureDecorator();
  return mDecorator.onInterceptTouchEvent(event) || super.onInterceptTouchEvent(event);
}

代码示例来源:origin: com.albedinsky.android/ui

/**
 */
@Override
public boolean onInterceptTouchEvent(@NonNull MotionEvent event) {
  this.ensureDecorator();
  return mDecorator.onInterceptTouchEvent(event) || super.onInterceptTouchEvent(event);
}

代码示例来源:origin: com.albedinsky.android/ui-widget-layout-scroll

/**
 */
@Override
public boolean onInterceptTouchEvent(@NonNull MotionEvent event) {
  this.ensureDecorator();
  return mDecorator.onInterceptTouchEvent(event) || super.onInterceptTouchEvent(event);
}

相关文章

ScrollView类方法