ps:簡書上編輯器比較難用,后續(xù)博客都在csdn上寫了,首頁:?滔lt的博客
adb shell input text hello //把hello這個內(nèi)容傳到有焦點的EditText之類的控件上
adb shell input keyevent 3 //相當(dāng)于按下home鍵,4是返回鍵
adb shell input keyevent --longpress 3//相當(dāng)于長按home鍵
adb shell input tap 250 200 //相當(dāng)于觸摸一下x250,y200的坐標(biāo)一下
adb shell input swipe 250 200 350 300 //相當(dāng)于從x250,y200坐標(biāo)滑動到x350,y300坐標(biāo)
adb shell input swipe 250 200 350 300 1000 //相當(dāng)于從x250,y200坐標(biāo)滑動到x350,y300坐標(biāo),共花1000毫秒
adb shell input swipe 250 200 250 200 2000 //相當(dāng)于長按x250,y200坐標(biāo)2000秒,(其實是從x250,y200滑動到x250,y200,中間花了2000毫秒,但是位置未改變,所以識別為長按,安卓系統(tǒng)規(guī)定單次距離不超過8dp視為未移動)
adb shell screenrecord /sdcard/demo.mp4 //錄制視頻并保存為后面的路徑
adb shell screenrecord ?--time-limit 10 /sdcard/demo.mp4 //設(shè)置錄制的時間為10秒,默認(rèn)為180秒
adb shell screenrecord --size 1280*720 /sdcard/demo.mp4 //指定視頻的分辨率,不指定默認(rèn)使用手機的分辨率
adb shell screenrecord --bit-rate 6000000 /sdcard/demo.mp4 //指定比特率,默認(rèn)為4Mbps
adb pull /sdcard/demo.mp4 //導(dǎo)出文件
ps:想獲取當(dāng)前觸摸的xy值,可以打開"開發(fā)者選項"->"指針位置"即可