Android:如何在ListView中以编程方式调用onScroll事件
我试图以编程方式调用ListView中的onScroll事件 有人能帮我吗 这是我的代码:Android:如何在ListView中以编程方式调用onScroll事件,android,events,onscroll,Android,Events,Onscroll,我试图以编程方式调用ListView中的onScroll事件 有人能帮我吗 这是我的代码: @RunWith(RobolectricTestRunner.class) public class ActivityListViewTest { private ActivityListView activity; @Before public void setUp() throws Exception { activity = new ActivityLis
@RunWith(RobolectricTestRunner.class)
public class ActivityListViewTest {
private ActivityListView activity;
@Before
public void setUp() throws Exception {
activity = new ActivityListView();
}
@Test
public void shouldUpdateListViewChildCountOnCreate() throws Exception{
activity.onCreate(null);
ListView calendarListView = (ListView)activity.findViewById(R.id.listview);
assertTrue("CHILD COUNT IS: " + calendarListView.getChildCount(), calendarListView.getChildCount() > 0);
// Here i want to invoke onScroll event. Then ListView must update and listView items count become to be more that 20
assertTrue("CHILD COUNT IS: " + calendarListView.getChildCount(), calendarListView.getChildCount() > 20);
}
}
从:
或
添加您正在使用的代码。。。
public void smoothScrollByOffset (int offset)
public void smoothScrollToPosition (int position)