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

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

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

ScrollView.requestDisallowInterceptTouchEvent介绍

暂无

代码示例

代码示例来源:origin: sealtalk/sealtalk-android

@Override
  public boolean onTouch(View v, MotionEvent event) {
    mScrollView.requestDisallowInterceptTouchEvent(true);
    return false;
  }
});

代码示例来源:origin: sealtalk/sealtalk-android

@Override
  public boolean onTouch(View v, MotionEvent event) {
    mScrollView.requestDisallowInterceptTouchEvent(true);
    return false;
  }
});

代码示例来源:origin: wangyisll/TessTwoDemo

@Override
  public boolean onTouch(View v, MotionEvent event) {
    if (event.getAction() == MotionEvent.ACTION_UP) {
      //允许ScrollView截断点击事件,ScrollView可滑动
      scrollView.requestDisallowInterceptTouchEvent(false);
    } else {
      //不允许ScrollView截断点击事件,点击事件由子View处理
      scrollView.requestDisallowInterceptTouchEvent(true);
    }
    return false;
  }
});

代码示例来源:origin: devinhu/androidone

@Override
public boolean onTouchEvent(MotionEvent event) {
  int action = event.getAction();
  switch (action) {
    case MotionEvent.ACTION_DOWN:
      if(scrollView != null){
        scrollView.requestDisallowInterceptTouchEvent(true);
      }
      break;

    case MotionEvent.ACTION_UP:
      if(scrollView != null){
        scrollView.requestDisallowInterceptTouchEvent(false);
      }
      break;
    }
  return super.onTouchEvent(event);
}

代码示例来源:origin: KishanV/Android-Music-Player

@Override
public void onUp(MotionEvent event) {
  super.onUp(event);
  sc.requestDisallowInterceptTouchEvent(false);
}

代码示例来源:origin: KishanV/Android-Music-Player

@Override
public void onDown(MotionEvent event) {
  super.onDown(event);
  sc.requestDisallowInterceptTouchEvent(true);
  X2 = event.getX();
  Y2 = event.getY();
  float deltaY = Y2 - YY;
  float deltaX = X2 - XX;
  val = (int) (Math.atan2(deltaY, deltaX) * 180 / Math.PI);
  Dis = val;
}

代码示例来源:origin: KishanV/Android-Music-Player

@Override
public void onDown(MotionEvent event) {
  super.onDown(event);
  sc.requestDisallowInterceptTouchEvent(true);
  X2 = event.getX();
  Y2 = event.getY();
  float deltaY = Y2 - YY;
  float deltaX = X2 - XX;
  val = (int) (Math.atan2(deltaY, deltaX) * 180 / Math.PI);
  Dis = val;
}

代码示例来源:origin: KishanV/Android-Music-Player

@Override
public void onUp(MotionEvent event) {
  super.onUp(event);
  sc.requestDisallowInterceptTouchEvent(false);
}

代码示例来源:origin: KishanV/Android-Music-Player

@Override
public void onDown(MotionEvent event) {
  super.onDown(event);
  sc.requestDisallowInterceptTouchEvent(true);
  X2 = event.getX();
  Y2 = event.getY();
  float deltaY = Y2 - YY;
  float deltaX = X2 - XX;
  val = (int) (Math.atan2(deltaY, deltaX) * 180 / Math.PI);
  Dis = val;
}

代码示例来源:origin: KishanV/Android-Music-Player

@Override
public void onUp(MotionEvent event) {
  super.onUp(event);
  sc.requestDisallowInterceptTouchEvent(false);
}

代码示例来源:origin: KishanV/Android-Music-Player

@Override
public void onUp(MotionEvent event) {
  super.onUp(event);
  sc.requestDisallowInterceptTouchEvent(false);
}

代码示例来源:origin: KishanV/Android-Music-Player

@Override
public void onDown(MotionEvent event) {
  super.onDown(event);
  sc.requestDisallowInterceptTouchEvent(true);
  X2 = event.getX();
  Y2 = event.getY();
  float deltaY = Y2 - YY;
  float deltaX = X2 - XX;
  val = (int) (Math.atan2(deltaY, deltaX) * 180 / Math.PI);
  Dis = val;
}

代码示例来源:origin: KishanV/Android-Music-Player

@Override
public void onUp(MotionEvent event) {
  super.onUp(event);
  sc.requestDisallowInterceptTouchEvent(false);
}

代码示例来源:origin: KishanV/Android-Music-Player

@Override
public void onDown(MotionEvent event) {
  super.onDown(event);
  sc.requestDisallowInterceptTouchEvent(true);
  X2 = event.getX();
  Y2 = event.getY();
  float deltaY = Y2 - YY;
  float deltaX = X2 - XX;
  val = (int) (Math.atan2(deltaY, deltaX) * 180 / Math.PI);
  Dis = val;
}

代码示例来源:origin: wangyisll/TessTwoDemo

@Override
  public boolean onTouch(View v, MotionEvent event) {
    int action = event.getAction();
    if(action == MotionEvent.ACTION_DOWN) {
      // 记录点击到ViewPager时候,手指的X坐标
      lastX = event.getX();
    }
    if(action == MotionEvent.ACTION_MOVE) {
      // 超过阈值
      if(Math.abs(event.getX() - lastX) > 30f) {
        viewPager.setEnabled(false);
        scrollView.requestDisallowInterceptTouchEvent(true);
      }
    }
    if(action == MotionEvent.ACTION_UP) {
      // 用户抬起手指,恢复父布局状态
      scrollView.requestDisallowInterceptTouchEvent(false);
      viewPager.setEnabled(true);
    }
    return false;
  }
});

相关文章

ScrollView类方法