//向左滑动publicstaticvoidswipeLeft(String time){//个人比较喜欢使用Thread.sleep 可以去使用mDevice.sleep();去尝试Thread.sleep(1000);int x = mDevice.getDisplayWidth();//获取屏幕的宽int y = mDevice.getDisplayHeight();//获取屏幕的高Log.e(TAG,"屏幕分辨率: "+ x +" X "+ y);
mDevice.swipe((int)(x /1.3), y /2, x /6, y /2,Integer.parseInt(time));//左滑 Thread.sleep(500);}
//向右滑动publicstaticvoidswipeRight(String time){Thread.sleep(1000);int x = mDevice.getDisplayWidth();//获取屏幕的宽int y = mDevice.getDisplayHeight();//获取屏幕的高Log.e(TAG,"屏幕分辨率: "+ x +" X "+ y);
mDevice.swipe(x /6, y /2,(int)(x /1.3), y /2,Integer.parseInt(time));//右滑Thread.sleep(500);}
//向下滑动publicstaticvoidswipeDown(String time){Thread.sleep(1000);int x = mDevice.getDisplayWidth();//获取屏幕的宽int y = mDevice.getDisplayHeight();//获取屏幕的高
mDevice.swipe(x /2, y /6, x /2,(int)(y /1.2),Integer.parseInt(time));//下滑Thread.sleep(500);}
//这里和上面一样 方法省略了而已//向上滑动int x = mDevice.getDisplayWidth();//获取屏幕的宽int y = mDevice.getDisplayHeight();//获取屏幕的高
mDevice.swipe(x /2,(int)(y /1.2), x /2, y /6,Integer.parseInt("200"));//上滑
mDevice.sleep();