robotium 滚屏操作超过一屏的listview处理
/** * 还有漏洞,需要补充 * 滚动超过一屏的listview item子项,并点击它 * * param index:在listview中的总的索引 * param linesNum: 一屏内listview Item的行数,比如可以指定多少行,根据不同的分辨率指定不同的行数 * param vIndex: 一屏内listview Item有效的行数索引 * param screenIndex: listview 指定行数的屏个数的索引 * param screenCount: listview 指定行数的总屏数 * * author:andrew * date: 2013.05.21 * email: 850811845@qq。com * */ public static void scrollOutsideScreenListItem(Solo solo,int index, int linesNum, int vIndex, int screenIndex, int screenCount){ if(vIndex < (linesNum+1)){ solo.clickInList(vIndex); solo.sleep(5000); vIndex ++; solo.goBack(); solo.sleep(3000); if(vIndex == linesNum){ DisplayMetrics outMetrics = new DisplayMetrics(); Activity act = solo.getCurrentActivity(); act.getWindowManager().getDefaultDisplay().getMetrics(outMetrics); float formX = outMetrics.widthPixels/4; float formY = outMetrics.heightPixels/4; if(formX < 30){ formX = 30; } if(formY (linesNum-1)){ int temp = (index%linesNum); solo.scrollDownList(temp); solo.sleep(3000); if(screenIndex < screenCount){ screenIndex++; } vIndex = 0; } } }