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

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

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

ScrollView.dispatchTouchEvent介绍

暂无

代码示例

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

return super.dispatchTouchEvent(ev);
return super.dispatchTouchEvent(ev);

代码示例来源:origin: HotBitmapGG/bilibili-android-client

public boolean dispatchTouchEvent(MotionEvent ev) {
  if (contentView == null) {
    return super.dispatchTouchEvent(ev);
  return super.dispatchTouchEvent(ev);

代码示例来源:origin: ZieIony/Carbon

return super.dispatchTouchEvent(ev);

代码示例来源:origin: weexteam/weex-hackernews

@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
 if (ev.getAction() == MotionEvent.ACTION_DOWN) {
  mRedirectTouchToStickyView = true;
 }
 if (mRedirectTouchToStickyView) {
  mRedirectTouchToStickyView = mCurrentStickyView != null;
  if (mRedirectTouchToStickyView) {
   mRedirectTouchToStickyView = ev.getY() <= mCurrentStickyView.getHeight()
                  && ev.getX() >= mCurrentStickyView.getLeft()
                  && ev.getX() <= mCurrentStickyView.getRight();
  }
 }
 if (mRedirectTouchToStickyView) {
  if (mScrollRect == null) {
   mScrollRect = new Rect();
   getGlobalVisibleRect(mScrollRect);
  }
  mCurrentStickyView.getLocationOnScreen(stickyViewP);
  ev.offsetLocation(0, stickyViewP[1] - mScrollRect.top);
 }
 return super.dispatchTouchEvent(ev);
}

代码示例来源:origin: Neamar/KISS

@Override
  public boolean dispatchTouchEvent(MotionEvent event) {
    // act as a modal, if we click outside dismiss the popup
    final int x = (int) event.getX();
    final int y = (int) event.getY();
    if ((event.getAction() == MotionEvent.ACTION_DOWN)
        && ((x < 0) || (x >= getWidth()) || (y < 0) || (y >= getHeight()))) {
      dismiss();
      return true;
    } else if (event.getAction() == MotionEvent.ACTION_OUTSIDE) {
      dismiss();
      return true;
    }
    return super.dispatchTouchEvent(event);
  }
}

代码示例来源:origin: colinNaive/RecyclerViewScrollView

@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
  return super.dispatchTouchEvent(ev);
}

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

@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
  return mHelper.handleDispatchTouchEvent(ev) || super.dispatchTouchEvent(ev);
}

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

@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
  // TODO Auto-generated method stub
  currentX = ev.getX();
  currentY = ev.getY();
  switch(ev.getAction()){
    case MotionEvent.ACTION_DOWN:
      break;
    case MotionEvent.ACTION_MOVE:
      distanceX = currentX - lastX;
      distanceY = currentY - lastY;
      if(Math.abs(distanceX)<Math.abs(distanceY) && Math.abs(distanceY)>12){
        upDownSlide = true;
      }
      break;
    case MotionEvent.ACTION_UP:
      break;
    default:
      break;
  }
  lastX = currentX;
  lastY = currentY;
  if (upDownSlide && inner != null) commOnTouchEvent(ev);
  return super.dispatchTouchEvent(ev);
}

代码示例来源:origin: jeasonlzy/VerticalSlideView

@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
  switch (ev.getAction()) {
    case MotionEvent.ACTION_DOWN:
      downX = ev.getX();
      downY = ev.getY();
      //如果滑动到了最底部,就允许继续向上滑动加载下一页,否者不允许
      getParent().requestDisallowInterceptTouchEvent(true);
      break;
    case MotionEvent.ACTION_MOVE:
      float dx = ev.getX() - downX;
      float dy = ev.getY() - downY;
      boolean allowParentTouchEvent;
      if (Math.abs(dy) > Math.abs(dx)) {
        if (dy > 0) {
          //位于顶部时下拉,让父View消费事件
          allowParentTouchEvent = isTop();
        } else {
          //位于底部时上拉,让父View消费事件
          allowParentTouchEvent = isBottom();
        }
      } else {
        //水平方向滑动
        allowParentTouchEvent = true;
      }
      getParent().requestDisallowInterceptTouchEvent(!allowParentTouchEvent);
  }
  return super.dispatchTouchEvent(ev);
}

代码示例来源:origin: moz1q1/WalleLibrary

@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
  if (ev.getAction() == MotionEvent.ACTION_DOWN) {
    redirectTouchesToStickyView = true;
  }
  if (redirectTouchesToStickyView) {
    redirectTouchesToStickyView = currentlyStickingView != null;
    if (redirectTouchesToStickyView) {
      redirectTouchesToStickyView =
          ev.getY() <= (currentlyStickingView.getHeight() + stickyViewTopOffset) &&
              ev.getX() >= getLeftForViewRelativeOnlyChild(currentlyStickingView) &&
              ev.getX() <= getRightForViewRelativeOnlyChild(currentlyStickingView);
    }
  } else if (currentlyStickingView == null) {
    redirectTouchesToStickyView = false;
  }
  if (redirectTouchesToStickyView) {
    ev.offsetLocation(0, -1 * ((getScrollY() + stickyViewTopOffset) - getTopForViewRelativeOnlyChild(currentlyStickingView)));
  }
  return super.dispatchTouchEvent(ev);
}

代码示例来源:origin: baiyuliang/QRobot

@Override
public boolean dispatchTouchEvent(MotionEvent event) {
  if (null == childView) {
    return super.dispatchTouchEvent(event);
  return super.dispatchTouchEvent(event);

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

return super.dispatchTouchEvent(ev);
return super.dispatchTouchEvent(ev);

代码示例来源:origin: stven0king/JsonHandleView

return intercept ? intercept : super.dispatchTouchEvent(event);

代码示例来源:origin: WelliJohn/StickScrollView

return super.dispatchTouchEvent(event);
  return super.dispatchTouchEvent(event);
    if (Math.abs(event.getX() - mLastX) < minPageSlop) {
      getParent().requestDisallowInterceptTouchEvent(true);
      return super.dispatchTouchEvent(event);
    } else {
      getParent().requestDisallowInterceptTouchEvent(true);
    if (Math.abs(event.getX() - mLastX) < minPageSlop) {
      getParent().requestDisallowInterceptTouchEvent(true);
      return super.dispatchTouchEvent(event);
    } else {
      getParent().requestDisallowInterceptTouchEvent(true);
    if (Math.abs(event.getX() - mLastX) < minPageSlop) {
      getParent().requestDisallowInterceptTouchEvent(true);
      return super.dispatchTouchEvent(event);
    } else {
      getParent().requestDisallowInterceptTouchEvent(true);
  getParent().requestDisallowInterceptTouchEvent(false);
return super.dispatchTouchEvent(event);

代码示例来源:origin: TheMelody/LotteryTrend

return super.dispatchTouchEvent(ev);
return super.dispatchTouchEvent(ev);

代码示例来源:origin: HotBitmapGG/LeisureRead

return super.dispatchTouchEvent(ev);
return super.dispatchTouchEvent(ev);

代码示例来源:origin: FussenYu/MVP_Project

return super.dispatchTouchEvent(ev);
return super.dispatchTouchEvent(ev);

代码示例来源:origin: cjiahuan/ReboundScrollView

return super.dispatchTouchEvent(ev);
return super.dispatchTouchEvent(ev);

代码示例来源:origin: stackoverflow.com

scrollViewRight.dispatchTouchEvent(motionEvent);
}else if (view.getId() == R.id.scrollview_right && view.isFocused()){
  scrollViewLeft.dispatchTouchEvent(motionEvent);

代码示例来源:origin: ThinkBear/GrabRedPacket

public boolean dispatchTouchEvent(MotionEvent ev) {
  if (contentView == null) {
    return super.dispatchTouchEvent(ev);
      break;
  return super.dispatchTouchEvent(ev);

相关文章

ScrollView类方法