adb 命令 pc端 "復制粘貼" 文本到android設備


假如你像我一樣在尋找android下通過命令復制粘貼的方法。
不過android上是沒有直接進行復制粘貼剪切板的命令,只有間接實現:

1、android設備

首先android設備上,要把光標焦點定位到需要輸入的文本框,比如當你輸入用戶名密碼的時候

2、PC端

電腦上adb連接好android設備
cmd 命令行
1、adb shell input text hell0
則hello自動的填到獲得焦點的輸入框了
2、adb shell input keyevent 61
輸入tab鍵定位到下一輸入框,
tab鍵的key code是61 --> "KEYCODE_TAB"
adb shell input keyevent 61
adb shell input keyevent 3
adb shell input keyevent 82
具體數值 看android源碼 android.view.KeyEvent.java
KEYCODE列表
3、input的命令

C:\Users\Administrator>adb shell input help Error: Unknown command: help usage: input ... input text <string> input keyevent <key code number or name> input [touchscreen|touchpad] tap <x> <y> input [touchscreen|touchpad] swipe <x1> <y1> <x2 input trackball press input trackball roll <dx> <dy>


作者:proud2008
鏈接:https://www.jianshu.com/p/d818290f70e5/
來源:簡書
簡書著作權歸作者所有,任何形式的轉載都請聯系作者獲得授權並注明出處。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM