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

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

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

TextView.dispatchTouchEvent介绍

暂无

代码示例

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

@Override
public boolean dispatchTouchEvent(@NonNull MotionEvent event) {
  if (rippleDrawable != null && event.getAction() == MotionEvent.ACTION_DOWN)
    rippleDrawable.setHotspot(event.getX(), event.getY());
  return super.dispatchTouchEvent(event);
}

代码示例来源:origin: robolectric/robolectric

@Test
public void onTouchEvent_shouldCallMovementMethodOnTouchEventWithSetMotionEvent() throws Exception {
 TestMovementMethod testMovementMethod = new TestMovementMethod();
 textView.setMovementMethod(testMovementMethod);
 textView.setLayoutParams(new FrameLayout.LayoutParams(100, 100));
 textView.measure(100, 100);
 MotionEvent event = MotionEvent.obtain(0, 0, 0, 0, 0, 0);
 textView.dispatchTouchEvent(event);
 assertEquals(testMovementMethod.event, event);
}

代码示例来源:origin: ASCE1885/AdvancedAndroidExample

@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
  switch (ev.getAction()) {
    case MotionEvent.ACTION_DOWN:
      Log.e(TAG, "dispatchTouchEvent ACTION_DOWN");
      break;
    case MotionEvent.ACTION_MOVE:
      Log.e(TAG, "dispatchTouchEvent ACTION_MOVE");
      break;
    case MotionEvent.ACTION_UP:
      Log.e(TAG, "dispatchTouchEvent ACTION_UP");
      break;
    case MotionEvent.ACTION_CANCEL:
      Log.e(TAG, "dispatchTouchEvent ACTION_CANCEL");
      break;
    default:
      break;
  }
  return super.dispatchTouchEvent(ev);
}

代码示例来源:origin: AlexMofer/ProjectX

@Override
public boolean dispatchTouchEvent(MotionEvent event) {
  final int action = event.getAction();
  switch (action) {
    case MotionEvent.ACTION_DOWN:
      setInterceptClick(false);
      super.setHighlightColor(mHighlightColor);
      break;
    case MotionEvent.ACTION_CANCEL:
    case MotionEvent.ACTION_UP:
      super.setHighlightColor(Color.TRANSPARENT);
      break;
    default:
      break;
  }
  return super.dispatchTouchEvent(event);
}

代码示例来源:origin: wangxp423/ViewExercise

@Override
  public boolean dispatchTouchEvent(MotionEvent event) {
    switch (event.getAction()) {
      case MotionEvent.ACTION_DOWN:
        LogUtils.d("Test", "ACTION_DOWN");
//                getParent().requestDisallowInterceptTouchEvent(true);
//                return true;
        break;
      case MotionEvent.ACTION_MOVE:
        LogUtils.d("Test", "ACTION_MOVE");
        break;
      case MotionEvent.ACTION_UP:
        LogUtils.d("Test", "ACTION_UP");
//                return true;
        break;
      case MotionEvent.ACTION_CANCEL:
        LogUtils.d("Test", "ACTION_CANCEL");
        break;
      default:
        LogUtils.d("Test", "default");
        break;
    }
    return super.dispatchTouchEvent(event);
//        return false;
//        return true;
  }

相关文章

TextView类方法