慢或快拖动向上(滚动)使用robotium [英] slow or fast drag up (scroll) using robotium

查看:145
本文介绍了慢或快拖动向上(滚动)使用robotium的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的code为拖了当前画面。

this my code for drag up current screen.

int screenWidth = getActivity().getWindowManager().getDefaultDisplay().getWidth();
int screenHeight = getActivity().getWindowManager().getDefaultDisplay().getHeight();
int fromX, toX, fromY, toY = 0;
fromX = screenWidth/2;
toX = screenWidth/2;
fromY = (screenHeight/2) + (screenHeight/3);
toY = (screenHeight/2) - (screenHeight/3);
int scroll_time = 10000;             
solo.sleep(5000);
    // Drag UP  
solo.drag(fromX, toX, fromY, toY, 40);
Log.d(TAG, "Drag 1");
    // here default origin (x,y = 0,0) is left upper corner

这里

滚动是工作,但速度很慢。

here scroll is working but very slow.

因此​​,对于快速滚动在这个code什么需要改变?

So for fast scroll what changes in this code required ?

推荐答案

我面临同样的问题,你需要做的是调整code的下面一行的东西,

I faced the same problem, what you need to do is adjust the following line of code,

solo.drag(fromX, toX, fromY, toY, 40); //Change 40 to 10

这会增加你的滚动速度,较低的步数,更快的滚动!

This will increase your scrolling speed, the lower the step count, the faster is the scrolling!

这篇关于慢或快拖动向上(滚动)使用robotium的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆