如何使用adb滚动应用程序?

Alo*_*lev 5 android adb

我正在寻找一种向上或向下滚动的方法,adb用于不同类型的应用程序.

如何使用adb命令滚动Facebook或CNN等应用程序?

j2k*_*2ko 14

向上滑动:

adb shell input swipe 300 300 500 1000 
Run Code Online (Sandbox Code Playgroud)

向下滚动:

adb shell input swipe 500 1000 300 300 
Run Code Online (Sandbox Code Playgroud)

如果您需要更精确的滑动,可以调整坐标.


sdg*_*sdh 12

您可以使用inputshell 命令。

用法:

adb shell input swipe <start_x> <start_y> <end_x> <end_y> duration_ms>
Run Code Online (Sandbox Code Playgroud)

因此,要向下滚动(向上滑动):

adb shell input swipe 250 800 250 400 300 
Run Code Online (Sandbox Code Playgroud)

或者向上滚动(向下滑动):

adb shell input swipe 250 400 250 800 300 
Run Code Online (Sandbox Code Playgroud)

确保您使用的坐标在设备的屏幕尺寸范围内!

您可以使用屏幕截图找出正确的坐标:

adb exec-out screencap -p > screen.png
Run Code Online (Sandbox Code Playgroud)