编程一扔ListView的机器人机器人、ListView

2023-09-05 11:17:23 作者:蜡笔小猪

有没有一种方法可以让我在编程列表视图执行一扔?我知道有猴子做所有这些事情,但需要与亚洲开发银行等等等等,我想用我的任何手机应用程序做一台电脑连接,没有猴子。

Is there a way I can programatically perform a Fling on a listview? I know there is monkey that does all these things but that requires a computer connection with adb etc etc. I want to do it with my app on any phone, without monkey.

谢谢, 费萨尔

推荐答案

您可以伪造它的动画(我认为accelerate_decelerate_interpolator可以做的工作)。

You can fake it with an anim (i think accelerate_decelerate_interpolator can do the job).

此外,它似乎还有通过自己的滚动视图的支持:

Also it seems there is support for scrolling your view by your own:

public void scrollBy (int x, int y)

移动视图的滚动位置。这将导致调用onScrollChanged(INT,INT,INT,INT)和视图将失效。

Move the scrolled position of your view. This will cause a call to onScrollChanged(int, int, int, int) and the view will be invalidated.

Parameters
x   the amount of pixels to scroll by horizontally
y   the amount of pixels to scroll by vertically

public void scrollTo (int x, int y)

设置视图的滚动位置。这将导致调用onScrollChanged(INT,INT,INT,INT)和视图将失效。

Set the scrolled position of your view. This will cause a call to onScrollChanged(int, int, int, int) and the view will be invalidated.


Parameters
x   the x position to scroll to
y   the y position to scroll to
 
精彩推荐
图片推荐