ADB simulates human-computer interaction events

Source: Internet
Author: User

1 input in terminal: adb shell

2 Enter input to get the following information:

Usage:input [<source>] <command> [<arg> ...]

Source: Event Sources

Command: Commands

ARG: Parameter

The sources are:
Trackball//Trackball, as if HTC Hero3 has this thing
Joystick//Joystick
Touchnavigation
Mouse
Keyboard//keyboard
GamePad
Touchpad
Dpad
Stylus
Touchscreen//Touch screen

The commands and default sources are:
Text <string> (Default:touchscreen)
KeyEvent [--longpress] <key code number or name> ... (Default:keyboard)
Tap <x> <y> (Default:touchscreen)
Swipe <x1> <y1> <x2> <y2> [Duration (ms)] (Default:touchscreen)
Press (Default:trackball)
Roll <dx> <dy> (Default:trackball)

Text: Literal input, parameter is a string, use two single quotation marks to cause

In the text input box to get focus, the ADB shell input eg:input text ' Hello World ', observe the effect

KeyEvent: Keyboard event, the number or name of the parameter that corresponds to the keyboard character

Used to perform various keyboard events, such as returning, tapping a button on the keyboard, etc., eg:input keyevent 3 = = Click the Home button

Tap: User Click event, parameter is absolute screen coordinates

Analog Click action: Eg:input tap + + click on the screen with a coordinate value of (100,100) point

Swipe: Slide event with the coordinates of the sliding start point and end point,

Eg:input Swipe (100,100) sliding from point Y1 to Y2 (200,200), you can also specify the time to slide, in MS

The command can also simulate long press events eg: adb shell input touchscreen swipe 187 187 (170,187) 2s time

Press is not quite clear, after use is similar to switching focus

Roll has not been used, there is no introduction







ADB simulates human-computer interaction events

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.