예제 #1
0
 /** 按下 */
 public void touchDown(int x, int y, int duration) {
   mTouchDownTime = SystemClock.uptimeMillis();
   MotionEvent event =
       MotionEvent.obtain(
           mTouchDownTime, mTouchDownTime + duration, MotionEvent.ACTION_DOWN, x, y, 0);
   event.setSource(InputDevice.SOURCE_TOUCHSCREEN);
   mUiAutomation.injectInputEvent(event, true);
 }
예제 #2
0
 /** 抬起 */
 public void touchUp(int x, int y) {
   MotionEvent event =
       MotionEvent.obtain(mTouchDownTime, mTouchDownTime, MotionEvent.ACTION_UP, x, y, 0);
   event.setSource(InputDevice.SOURCE_TOUCHSCREEN);
   mUiAutomation.injectInputEvent(event, true);
 }