本文整理了Java中android.widget.ImageView.dispatchTouchEvent()
方法的一些代码示例,展示了ImageView.dispatchTouchEvent()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ImageView.dispatchTouchEvent()
方法的具体详情如下:
包路径:android.widget.ImageView
类名称:ImageView
方法名: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: Hitomis/transferee
@Override
public boolean dispatchTouchEvent(MotionEvent event) {
if (isEnable) {
final int Action = event.getActionMasked();
if (event.getPointerCount() >= 2) hasMultiTouch = true;
mDetector.onTouchEvent(event);
mRotateDetector.onTouchEvent(event);
mScaleDetector.onTouchEvent(event);
if (Action == MotionEvent.ACTION_UP || Action == MotionEvent.ACTION_CANCEL) onUp();
return true;
} else {
return super.dispatchTouchEvent(event);
}
}
代码示例来源:origin: bm-x/PhotoView
@Override
public boolean dispatchTouchEvent(MotionEvent event) {
if (isEnable) {
final int Action = event.getActionMasked();
if (event.getPointerCount() >= 2) hasMultiTouch = true;
mDetector.onTouchEvent(event);
if (isRotateEnable) {
mRotateDetector.onTouchEvent(event);
}
mScaleDetector.onTouchEvent(event);
if (Action == MotionEvent.ACTION_UP || Action == MotionEvent.ACTION_CANCEL) onUp();
return true;
} else {
return super.dispatchTouchEvent(event);
}
}
代码示例来源:origin: lyft/scissors
@Override
public boolean dispatchTouchEvent(MotionEvent event) {
boolean result = super.dispatchTouchEvent(event);
if (!isEnabled()) {
return result;
}
touchManager.onEvent(event);
invalidate();
return true;
}
代码示例来源:origin: cymcsg/UltimateAndroid
@Override
public boolean dispatchTouchEvent(MotionEvent event) {
// Check for clickable state and do nothing if disabled
if(!this.isClickable()) {
this.isSelected = false;
return super.onTouchEvent(event);
}
// Set selected state based on Motion Event
switch(event.getAction()) {
case MotionEvent.ACTION_DOWN:
this.isSelected = true;
break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_SCROLL:
case MotionEvent.ACTION_OUTSIDE:
case MotionEvent.ACTION_CANCEL:
this.isSelected = false;
break;
}
// Redraw image and return super type
this.invalidate();
return super.dispatchTouchEvent(event);
}
代码示例来源:origin: tianshaojie/AndroidFine
@Override
public boolean dispatchTouchEvent(MotionEvent event) {
if (isEnable) {
mDetector.onTouchEvent(event);
mScaleDetector.onTouchEvent(event);
final int Action = event.getAction();
if (Action == MotionEvent.ACTION_UP || Action == MotionEvent.ACTION_CANCEL) onUp(event);
} else {
return super.dispatchTouchEvent(event);
}
return true;
}
代码示例来源:origin: gdutxiaoxu/TouchDemo
@Override
public boolean dispatchTouchEvent(MotionEvent event) {
int x = (int) event.getY();
int y = (int) event.getX();
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
getParent().requestDisallowInterceptTouchEvent(true);
break;
case MotionEvent.ACTION_POINTER_DOWN:
getParent().requestDisallowInterceptTouchEvent(true);
onPointerDown(event);
break;
case MotionEvent.ACTION_MOVE:
if (mode != MODE.NONE) {
getParent().requestDisallowInterceptTouchEvent(true);
} else {
getParent().requestDisallowInterceptTouchEvent(false);
}
break;
}
mLastX = x;
mLastY = y;
return super.dispatchTouchEvent(event);
}
代码示例来源:origin: FreedomZZQ/YouJoin-Android
@Override
public boolean dispatchTouchEvent(MotionEvent event) {
// Check for clickable state and do nothing if disabled
if (!this.isClickable()) {
this.isSelected = false;
return super.onTouchEvent(event);
}
// Set selected state based on Motion Event
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
this.isSelected = true;
break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_SCROLL:
case MotionEvent.ACTION_OUTSIDE:
case MotionEvent.ACTION_CANCEL:
this.isSelected = false;
break;
}
// Redraw image and return super type
this.invalidate();
return super.dispatchTouchEvent(event);
}
代码示例来源:origin: RameshBhupathi/CollapsingToolbar-With-Webview
@Override
public boolean dispatchTouchEvent(MotionEvent event) {
// Check for clickable state and do nothing if disabled
if (!this.isClickable()) {
this.isSelected = false;
return super.onTouchEvent(event);
}
// Set selected state based on Motion Event
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
this.isSelected = true;
break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_SCROLL:
case MotionEvent.ACTION_OUTSIDE:
case MotionEvent.ACTION_CANCEL:
this.isSelected = false;
break;
}
// Redraw image and return super type
this.invalidate();
return super.dispatchTouchEvent(event);
}
内容来源于网络,如有侵权,请联系作者删除!