android.view.MotionEvent.toString()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(172)

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

MotionEvent.toString介绍

暂无

代码示例

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

@Test
public void testToString() {
 // make sure this method never throw exception.
 motionEvent2.toString();
}

代码示例来源:origin: oubowu/PinnedSectionItemDecoration

@Override
public void onTouchEvent(@NonNull RecyclerView rv, @NonNull MotionEvent e) {
  Log.i(TAG, "onTouchEvent(): " + e.toString());
  mGestureDetector.onTouchEvent(e);
}

代码示例来源:origin: luhaoaimama1/zone-sdk

@Override
  public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
    System.out.println("onFling: " + e1.toString()+e2.toString());
    return true;
  }
};

代码示例来源:origin: luhaoaimama1/zone-sdk

@Override
public boolean onFling(MotionEvent event1,
    MotionEvent event2, float velocityX, float velocityY) {
  // 快速滑动
  Log.d(DEBUG_TAG, "onFling: " + event1.toString()
      + event2.toString());
  showMessage("快速滑动");
  return true;
}

代码示例来源:origin: luhaoaimama1/zone-sdk

@Override
  public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
    Log("onFling: " + e1.toString()+e2.toString());
    if(eventType==EventType.Other)
      return false;
    return moveListener.onFling(e1,e2,velocityX,velocityY);
  }
};

代码示例来源:origin: luhaoaimama1/zone-sdk

@Override
public boolean onDown(MotionEvent e) {
  move=new Path();
  move.moveTo(e.getX(),e.getY());
  System.out.println("onDown:"+e.toString());
  return true;
}

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

class MyGestureListener extends GestureDetector.SimpleOnGestureListener {
  private static final String DEBUG_TAG = "Gestures"; 

  @Override
  public boolean onDown(MotionEvent event) { 
    Log.d(DEBUG_TAG,"onDown: " + event.toString()); 
    return true;
  }

  @Override
  public boolean onFling(MotionEvent start, MotionEvent finish, float velocityX, float velocityY) {
    if (start.getRawY() < finish.getRawY()) {
      //down
    } else {
      //up
    }
  return true;
  }
}

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

class MyGestureListener extends GestureDetector.SimpleOnGestureListener 
{            
  @Override
  public boolean onDown(MotionEvent event) 
  { 
    Log.d(TAG,"onDown: " + event.toString()); 
    return true;
  }

  @Override
  public boolean onFling(MotionEvent start, MotionEvent finish, float velocityX, float velocityY) 
  {
    if (start.getRawY() < finish.getRawY()) {
      //down
    } else {
      //up
    }

    return true;
  }
}

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

private View.OnTouchListener onTouchLiveListener = new View.OnTouchListener() {

  @Override
  public boolean onTouch(View view, MotionEvent motionEvent) {
    if(motionEvent.getPointerCount()>1){
      if(motionEvent.getY(1) > someNumber){
        //Case when we touch the dead zone, TODO do some ...
      }
    }
    text.setText(motionEvent.toString());
    return true;
  }

};

代码示例来源:origin: luhaoaimama1/zone-sdk

@Override
public boolean onSingleTapUp(MotionEvent e) {
  // 单击事件
  Log.d(DEBUG_TAG, "onSingleTapUp: " + e.toString());
  showMessage("单击事件");
  return super.onSingleTapUp(e);
}

代码示例来源:origin: luhaoaimama1/zone-sdk

@Override
public boolean onDown(MotionEvent e) {
  Log("onDown:"+e.toString());
  if(eventType==EventType.Other)
    return false;
  return moveListener.onDown(e);
}

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

private static final int SWIPE_MIN_DISTANCE = 120;
private static final int SWIPE_MAX_OFF_PATH = 250;
private static final int SWIPE_THRESHOLD_VELOCITY = 100;
@Override
  public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
      float velocityY) {
    Log.d("---onFling---", e1.toString() + e2.toString() + "");

    try {
      if (Math.abs(e1.getY() - e2.getY()) > SWIPE_MAX_OFF_PATH)
        return false;
      // right to left swipe
      if (e1.getX() - e2.getX() > SWIPE_MIN_DISTANCE
          && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) {
        //do your code

      } else if (e2.getX() - e1.getX() > SWIPE_MIN_DISTANCE
          && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) {
        //left to right flip
        }
      }
    } catch (Exception e) {
      // nothing
    }
    return false;
  }

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

public boolean onTouchEvent( MotionEvent event) {
   super.onTouchEvent(event);
   Log.d ("motionEvent", event.toString());
    if (event.getAction()==MotionEvent.ACTION_UP){
    Log.d("motionEvent", "action_up");

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

@Override
public boolean onTouchEvent(MotionEvent event)
{
  boolean handled = super.onTouchEvent(event);
  Log.d("test", "event " + event.toString());
  int action = event.getAction();

  switch (action)
  {
  case MotionEvent.ACTION_DOWN:
    m_downPosition = pointToPosition((int)event.getX(), (int)event.getY());
    Log.d("test", "The down position " + m_downPosition);
    break;

  case MotionEvent.ACTION_UP:
  case MotionEvent.ACTION_CANCEL:
    int position = m_downPosition - getFirstVisiblePosition();
    View child = INVALID_POSITION != m_downPosition ? getChildAt(position) : null;
    if (null != child)
    {
      child.setPressed(false);
    }
    break;

  default:
    break;
  }
  return handled;
}

代码示例来源:origin: gkasten/drrickorang

@Override
public boolean onDown(MotionEvent event) {
  Log.d(DEBUG_TAG, "onDown: " + event.toString() + " " + TAG);
  if (!mScroller.isFinished()) {
    mScroller.forceFinished(true);
    refreshGraph();
  }
  return true;
}

代码示例来源:origin: luhaoaimama1/zone-sdk

public boolean onTouchEvent(@NonNull MotionEvent event) {
  switch (event.getAction()&MotionEvent.ACTION_MASK) {
    case MotionEvent.ACTION_DOWN:
      Log("ACTION_DOWN:"+event.toString());
      break;
    case MotionEvent.ACTION_POINTER_DOWN:
      eventType=EventType.Other;
      Log("ACTION_POINTER_DOWN222:"+event.toString());
      break;
    case MotionEvent.ACTION_MOVE:
      break;
    case MotionEvent.ACTION_UP:
      Log("ACTION_UP:"+event.toString());
      clearHistory();
      break;
    case MotionEvent.ACTION_POINTER_UP:
      eventType=EventType.Move;
      Log("ACTION_POINTER_UP2222:"+event.toString());
      break;
  }
  boolean scaleResult = scaleGesture.onTouchEvent(event);
  boolean ratotionResult = ratotionGesture.onTouchEvent(event);
  boolean moveResult =moveGesture.onTouchEvent(event);
  return scaleResult||ratotionResult||moveResult;
}

代码示例来源:origin: gkasten/drrickorang

@Override
public boolean onDoubleTap(MotionEvent event) {
  Log.d(DEBUG_TAG, "onDoubleTap: " + event.toString());
  int tappedSample = (int) (event.getX() * getZoom());
  setZoom(getZoom() / 2);
  setOffset(tappedSample / 2, true);
  refreshGraph();
  return true;
}

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

Log.d(TAG, "Ignored touch event: " + event.toString());
return false;

代码示例来源:origin: LightSun/android-drag-FlowLayout

@Override
public boolean onTouchEvent(MotionEvent event) {
  sDebugger.i("onTouchEvent", event.toString());
  //sDebugger.i("onTouchEvent", "------> mDispatchToAlertWindow = " + mDispatchToAlertWindow +" ,mIsDragState = " + mIsDragState);
  if (!mDraggable) {
    return super.onTouchEvent(event);
  }
  final boolean handled = mGestureDetector.onTouchEvent(event);
  mCancelled = event.getAction() == MotionEvent.ACTION_CANCEL || event.getAction() == MotionEvent.ACTION_UP;
  //解决ScrollView嵌套DragFlowLayout时,引起的事件冲突
  if (getParent() != null) {
    getParent().requestDisallowInterceptTouchEvent(mRequestedDisallowIntercept || mDragState != DRAG_STATE_IDLE);
  }
  if (mDispatchToAlertWindow) {
    mWindomHelper.getView().dispatchTouchEvent(event);
    if (mCancelled) {
      mDispatchToAlertWindow = false;
    }
  }
  return handled;
}
//=================================== end -- override method ===================================== //

代码示例来源:origin: twilio/video-quickstart-android

break;
default:
  Log.d(TAG, "Ignored touch event: " + event.toString());
  return false;

相关文章