adb shell 长按屏幕,触摸不终止
时间: 2023-08-16 21:05:54 浏览: 110
在 Android 设备上使用 adb shell 长按屏幕时,需要使用以下命令:
```
adb shell input touchscreen swipe x1 y1 x2 y2 duration
```
其中,x1、y1 和 x2、y2 分别是起点和终点的坐标,duration 是滑动的时间(以毫秒为单位)。如果想要模拟长按,则需要将 duration 参数设置为一个较大的值,例如 3000 毫秒。例如,要在屏幕上长按一个位置,可以使用以下命令:
```
adb shell input touchscreen swipe x y x y 3000
```
执行该命令后,将会在指定位置长按 3 秒钟,直到手动终止。如果触摸不终止,可能是设备出现了一些问题,可以尝试重新启动设备或使用其他设备进行测试。
相关问题
adb shell 长按屏幕指定位置
在 Android 设备上,您可以通过 `input` 命令模拟触摸屏幕的操作。以下是使用 `input` 命令模拟长按屏幕指定位置的步骤:
1. 首先,您需要打开设备的开发者选项和 USB 调试功能。您可以在设备的设置中找到这些选项。
2. 连接设备到计算机,并打开命令行终端或命令提示符窗口。
3. 运行以下命令以获取要长按的位置的坐标:
```
adb shell input tap x y
```
其中,`x` 和 `y` 分别是屏幕上要长按的位置的横坐标和纵坐标。您可以使用 `adb shell getevent -l` 命令在设备上查看当前触摸事件的坐标。
4. 运行以下命令,以在指定位置长按屏幕:
```
adb shell input touchscreen swipe x y x y duration
```
其中,`duration` 是长按的时间(以毫秒为单位)。您可以尝试不同的时间值以获得最佳效果。
希望这可以帮助您模拟长按屏幕指定位置。
adb shell 长按指定位置,触摸时不终止
你可以使用以下命令来模拟长按和触摸:
```
adb shell input touchscreen swipe <x1> <y1> <x2> <y2> <duration in ms>
```
其中,`<x1>` 和 `<y1>` 是长按的起始坐标,`<x2>` 和 `<y2>` 是长按的结束坐标,`<duration in ms>` 是长按的时间(以毫秒为单位)。
例如,要在坐标 `(100, 200)` 处长按并在坐标 `(300, 400)` 处触摸,可以使用以下命令:
```
adb shell input touchscreen swipe 100 200 300 400 2000
```
这会在坐标 `(100, 200)` 处长按 2 秒钟,并在坐标 `(300, 400)` 处触摸。请注意,长按的时间应该足够长,以确保它被识别为长按而不是单击。