首页 > 代码库 > robotium listview上拉加载更多/下拉刷新

robotium listview上拉加载更多/下拉刷新

        ListView listview = (ListView) solo.getView("id/list");        int[] location = new int[2];        listview.getLocationOnScreen(location);        location[1] = location[1] + listview.getBottom();        Log.i(TAG, "[Location x]:  " + Integer.toString(location[0]));        Log.i(TAG, "[Location y]:  " + Integer.toString(location[1]));
//获取上拉加载更多拖动点的坐标
if (solo.waitForView(listview)) { int newlistcount, listcount = listview.getCount(); while (true) { solo.scrollListToLine(listview, listcount); solo.sleep(500); solo.drag(location[0] + 10f, location[0] + 10f, location[1] - 10f, location[0] - 100f, 50); solo.sleep(2000); newlistcount = listview.getCount(); if (newlistcount == listcount) { break; } else { listcount = newlistcount; Log.i(TAG, "[List count]: " + Integer.toString(listcount)); } } }

 

robotium listview上拉加载更多/下拉刷新