本章主要介绍touch事件

void touch ( integer x, integer y, string type)

Sends a touch event specified by type to the screen location specified by x and y.

Arguments
x The horizontal position of the touch in actual device pixels, starting from the left of the screen in its current orientation.
y The vertical position of the touch in actual device pixels, starting from the top of the screen in its current orientation.
type The type of key event to send. The allowed values are DOWN, UP, and DOWN_AND_UP.

string DOWN

press() or touch() value. Specifies that a DOWN event type should be sent to the device, corresponding to pressing down on a key or touching the screen.

string UP

press() or touch() value. Specifies that an UP event type should be sent to the device, corresponding to releasing a key or lifting up from the screen.

string DOWN_AND_UP

press(), touch() or type() value. Specifies that a DOWN event type followed by an UP event type should be sent to the device, corresponding to typing a key or clicking the screen.


例子:

   for i in range(200):
    device.touch(100,600,"DOWN_AND_UP")
    MonkeyRunner.sleep(5)
    device.touch(240,750,"DOWN")
    MonkeyRunner.sleep(5)
    device.touch(400,750,"UP")
    MonkeyRunner.sleep(5)



更多相关文章

  1. android之实现各个组件点击事件监听
  2. 强强学Android_Android事件传递
  3. android 入门demo 事件监听
  4. Android(安卓)上传图片到C#接口 例子
  5. android 入门 AlarmManager 例子
  6. Android(安卓)2d物理引擎Box2d介绍
  7. Android(安卓)OnTouchListener 触摸事件 & GestureDetector 手势
  8. android、pull解析xml
  9. Android(安卓)ListView列表分组

随机推荐

  1. Android开发人员面试整理
  2. 原创:Android 基础 控件 之 TextVIew(一)
  3. Android BaseAdapter 例子
  4. android之PULL生成xml文档
  5. 使用HTTPclient访问豆瓣API问题
  6. Android 滚动时间选择
  7. Android OpenGL ES 画正方形
  8. android通过BitmapFactory.decodeFile获
  9. Android实现KSOAP2访问WebService
  10. Android 如何 画 柱状图 -------自定义Vi