在Robotium快速滚动 [英] Fast scroll in Robotium
问题描述
我已经创建了我的Android项目测试项目。在我的应用程序有一个具有大量数据的列表视图。我需要滚动列表视图这个上下使用Robotium。我已经使用了 scrollUp()
和下滚()
的功能,但它实在是太缓慢滚动。
我使用Robotium 3.3。有没有什么办法让一个快速滚动?
INT屏幕宽度= getActivity()getWindowManager()getDefaultDisplay()的getWidth()。;
INT screenHeight = getActivity()getWindowManager()getDefaultDisplay()的getHeight()。; INT fromX,TOX,弗罗米,玩具= 0,STEPCOUNT = 1; //向下滚动//向上拖动
fromX =屏幕宽度/ 2;
TOX =屏幕宽度/ 2;
弗罗米=(screenHeight / 2)+(screenHeight / 3);
玩具=(screenHeight / 2) - (screenHeight / 3);solo.drag(fromX,TOX,弗罗米,玩具,STEPCOUNT);
在这里
[1] STEPCOUNT = 1; //非常快速滚动
[2] STEPCOUNT = 10; //滚动中等
[3] STEPCOUNT = 17; //慢滚动
所以,您可以根据您的滚动所需的速度调整STEPCOUNT的价值。
我希望这将帮助你更好的滚动列表视图。
谢谢你。
I have created a test project for my Android project. In my app there is a listview that has a lot of data. I need to scroll this listview up and down using Robotium. I have used the scrollUp()
and scrollDown()
functions, but it is scrolling too slowly.
I am using Robotium 3.3. Is there any way to make a fast scroll?
int screenWidth = getActivity().getWindowManager().getDefaultDisplay().getWidth();
int screenHeight = getActivity().getWindowManager().getDefaultDisplay().getHeight();
int fromX, toX, fromY, toY = 0,stepCount=1;
// Scroll Down // Drag Up
fromX = screenWidth/2;
toX = screenWidth/2;
fromY = (screenHeight/2) + (screenHeight/3);
toY = (screenHeight/2) - (screenHeight/3);
solo.drag(fromX, toX, fromY, toY, stepCount);
here
[1] stepCount=1; // very fast scroll
[2] stepCount=10; // medium scroll
[3] stepCount=17; // slow scroll
So you adjust " stepCount " value according to your scroll required speed.
i hope this will help you for your better scroll list view. Thanks.
这篇关于在Robotium快速滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!