- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
到目前为止,我能够使用 adb 命令点击、滑动、解锁、安装/卸载和启动应用程序,但无法找到如何使用 adb 命令执行放大/缩小。
我有捏合/捏合的坐标,但不明白如何从终端使用 adb 命令触发它们。
例如,我们有命令 --> adb shell 输入 tap x y 所以在这里我们可以类似地用值/坐标替换 x 和 y 我想知道模拟捏合/捏合的方法。
我得到的捏入坐标如下。
{"id":0,"dumb":[{"events":[{"id":0,"pressure":1,"x":392.94117647058823,"y":607.4264705882354}],"action":0},{"events":[{"id":0,"pressure":1,"x":392.94117647058823,"y":607.4264705882354},{"id":1,"pressure":1,"x":327.05882352941177,"y":672.5735294117648}],"action":261},{"events":[{"id":0,"pressure":1,"x":392.94117647058823,"y":609.7794117647059},{"id":1,"pressure":1,"x":327.05882352941177,"y":670.2205882352941}],"action":2},{"events":[{"id":0,"pressure":1,"x":392.94117647058823,"y":612.1323529411765},{"id":1,"pressure":1,"x":327.05882352941177,"y":667.8676470588235}],"action":2},{"events":[{"id":0,"pressure":1,"x":392.94117647058823,"y":616.8382352941177},{"id":1,"pressure":1,"x":327.05882352941177,"y":663.1617647058823}],"action":2},{"events":[{"id":0,"pressure":1,"x":392.94117647058823,"y":626.25},{"id":1,"pressure":1,"x":327.05882352941177,"y":653.75}],"action":2},{"events":[{"id":0,"pressure":1,"x":392.94117647058823,"y":630.9558823529412},{"id":1,"pressure":1,"x":327.05882352941177,"y":649.0441176470589}],"action":2},{"events":[{"id":0,"pressure":1,"x":395.29411764705884,"y":635.6617647058823},{"id":1,"pressure":1,"x":324.70588235294116,"y":644.3382352941177}],"action":2},{"events":[{"id":0,"pressure":1,"x":397.64705882352945,"y":642.7205882352941},{"id":1,"pressure":1,"x":322.3529411764706,"y":637.2794117647059}],"action":2},{"events":[{"id":0,"pressure":1,"x":400,"y":649.7794117647059},{"id":1,"pressure":1,"x":320,"y":630.2205882352941}],"action":2},{"events":[{"id":0,"pressure":1,"x":402.3529411764706,"y":656.8382352941177},{"id":1,"pressure":1,"x":317.64705882352945,"y":623.1617647058823}],"action":2},{"events":[{"id":0,"pressure":1,"x":402.3529411764706,"y":661.5441176470589},{"id":1,"pressure":1,"x":317.64705882352945,"y":618.4558823529412}],"action":2},{"events":[{"id":0,"pressure":1,"x":404.7058823529412,"y":668.6029411764706},{"id":1,"pressure":1,"x":315.29411764705884,"y":611.3970588235294}],"action":2},{"events":[{"id":0,"pressure":1,"x":404.7058823529412,"y":673.3088235294118},{"id":1,"pressure":1,"x":315.29411764705884,"y":606.6911764705883}],"action":2},{"events":[{"id":0,"pressure":1,"x":404.7058823529412,"y":680.3676470588235},{"id":1,"pressure":1,"x":315.29411764705884,"y":599.6323529411765}],"action":2},{"events":[{"id":0,"pressure":1,"x":407.05882352941177,"y":685.0735294117648},{"id":1,"pressure":1,"x":312.94117647058823,"y":594.9264705882354}],"action":2},{"events":[{"id":0,"pressure":1,"x":407.05882352941177,"y":687.4264705882354},{"id":1,"pressure":1,"x":312.94117647058823,"y":592.5735294117648}],"action":2},{"events":[{"id":0,"pressure":1,"x":409.4117647058824,"y":689.7794117647059},{"id":1,"pressure":1,"x":310.5882352941177,"y":590.2205882352941}],"action":2},{"events":[{"id":0,"pressure":1,"x":411.7647058823529,"y":694.4852941176471},{"id":1,"pressure":1,"x":308.2352941176471,"y":585.5147058823529}],"action":2},{"events":[{"id":0,"pressure":1,"x":411.7647058823529,"y":699.1911764705883},{"id":1,"pressure":1,"x":308.2352941176471,"y":580.8088235294118}],"action":2},{"events":[{"id":0,"pressure":1,"x":414.11764705882354,"y":706.25},{"id":1,"pressure":1,"x":305.88235294117646,"y":573.75}],"action":2},{"events":[{"id":0,"pressure":1,"x":416.47058823529414,"y":713.3088235294118},{"id":1,"pressure":1,"x":303.5294117647059,"y":566.6911764705883}],"action":2},{"events":[{"id":0,"pressure":1,"x":418.8235294117647,"y":715.6617647058824},{"id":1,"pressure":1,"x":301.1764705882353,"y":564.3382352941177}],"action":2},{"events":[{"id":0,"pressure":1,"x":418.8235294117647,"y":718.0147058823529},{"id":1,"pressure":1,"x":301.1764705882353,"y":561.9852941176471}],"action":2},{"events":[{"id":0,"pressure":1,"x":418.8235294117647,"y":720.3676470588235},{"id":1,"pressure":1,"x":301.1764705882353,"y":559.6323529411765}],"action":2},{"events":[{"id":0,"pressure":1,"x":421.1764705882353,"y":727.4264705882354},{"id":1,"pressure":1,"x":298.8235294117647,"y":552.5735294117648}],"action":2},{"events":[{"id":0,"pressure":1,"x":421.1764705882353,"y":732.1323529411765},{"id":1,"pressure":1,"x":298.8235294117647,"y":547.8676470588235}],"action":2},{"events":[{"id":0,"pressure":1,"x":423.5294117647059,"y":739.1911764705883},{"id":1,"pressure":1,"x":296.47058823529414,"y":540.8088235294118}],"action":2},{"events":[{"id":0,"pressure":1,"x":425.88235294117646,"y":746.25},{"id":1,"pressure":1,"x":294.11764705882354,"y":533.75}],"action":2},{"events":[{"id":0,"pressure":1,"x":425.88235294117646,"y":753.3088235294118},{"id":1,"pressure":1,"x":294.11764705882354,"y":526.6911764705883}],"action":2},{"events":[{"id":0,"pressure":1,"x":428.2352941176471,"y":758.0147058823529},{"id":1,"pressure":1,"x":291.7647058823529,"y":521.9852941176471}],"action":2},{"events":[{"id":0,"pressure":1,"x":435.29411764705884,"y":765.0735294117648},{"id":1,"pressure":1,"x":284.70588235294116,"y":514.9264705882354}],"action":2},{"events":[{"id":0,"pressure":1,"x":440,"y":769.7794117647059},{"id":1,"pressure":1,"x":280,"y":510.22058823529414}],"action":2},{"events":[{"id":0,"pressure":1,"x":440,"y":779.1911764705883},{"id":1,"pressure":1,"x":280,"y":500.80882352941177}],"action":2},{"events":[{"id":0,"pressure":1,"x":444.7058823529412,"y":788.6029411764706},{"id":1,"pressure":1,"x":275.29411764705884,"y":491.39705882352945}],"action":2},{"events":[{"id":0,"pressure":1,"x":451.7647058823529,"y":800.3676470588235},{"id":1,"pressure":1,"x":268.2352941176471,"y":479.63235294117646}],"action":2},{"events":[{"id":0,"pressure":1,"x":456.47058823529414,"y":812.1323529411765},{"id":1,"pressure":1,"x":263.5294117647059,"y":467.86764705882354}],"action":2},{"events":[{"id":0,"pressure":1,"x":461.1764705882353,"y":821.5441176470589},{"id":1,"pressure":1,"x":258.8235294117647,"y":458.4558823529412}],"action":2},{"events":[{"id":0,"pressure":1,"x":465.88235294117646,"y":833.3088235294118},{"id":1,"pressure":1,"x":254.11764705882354,"y":446.69117647058823}],"action":2},{"events":[{"id":0,"pressure":1,"x":470.5882352941177,"y":840.3676470588235},{"id":1,"pressure":1,"x":249.41176470588235,"y":439.63235294117646}],"action":2},{"events":[{"id":0,"pressure":1,"x":475.29411764705884,"y":847.4264705882354},{"id":1,"pressure":1,"x":244.7058823529412,"y":432.5735294117647}],"action":2},{"events":[{"id":0,"pressure":1,"x":477.64705882352945,"y":854.4852941176471},{"id":1,"pressure":1,"x":242.3529411764706,"y":425.5147058823529}],"action":2},{"events":[{"id":0,"pressure":1,"x":482.3529411764706,"y":863.8970588235294},{"id":1,"pressure":1,"x":237.64705882352942,"y":416.1029411764706}],"action":2},{"events":[{"id":0,"pressure":1,"x":484.7058823529412,"y":870.9558823529412},{"id":1,"pressure":1,"x":235.29411764705884,"y":409.04411764705884}],"action":2},{"events":[{"id":0,"pressure":1,"x":489.4117647058824,"y":875.6617647058824},{"id":1,"pressure":1,"x":230.58823529411765,"y":404.3382352941177}],"action":2},{"events":[{"id":0,"pressure":1,"x":489.4117647058824,"y":878.0147058823529},{"id":1,"pressure":1,"x":230.58823529411765,"y":401.9852941176471}],"action":2},{"events":[{"id":0,"pressure":1,"x":491.764705882353,"y":882.7205882352941},{"id":1,"pressure":1,"x":228.23529411764707,"y":397.2794117647059}],"action":2},{"events":[{"id":0,"pressure":1,"x":494.11764705882354,"y":885.0735294117648},{"id":1,"pressure":1,"x":225.88235294117646,"y":394.9264705882353}],"action":2},{"events":[{"id":0,"pressure":1,"x":496.47058823529414,"y":892.1323529411765},{"id":1,"pressure":1,"x":223.52941176470588,"y":387.86764705882354}],"action":2},{"events":[{"id":0,"pressure":1,"x":501.1764705882353,"y":899.1911764705883},{"id":1,"pressure":1,"x":218.82352941176472,"y":380.80882352941177}],"action":2},{"events":[{"id":0,"pressure":1,"x":503.5294117647059,"y":908.6029411764706},{"id":1,"pressure":1,"x":216.47058823529412,"y":371.39705882352945}],"action":2},{"events":[{"id":0,"pressure":1,"x":505.88235294117646,"y":908.6029411764706},{"id":1,"pressure":1,"x":214.11764705882354,"y":371.39705882352945}],"action":2},{"events":[{"id":0,"pressure":1,"x":505.88235294117646,"y":910.9558823529412},{"id":1,"pressure":1,"x":214.11764705882354,"y":369.04411764705884}],"action":2},{"events":[{"id":0,"pressure":1,"x":505.88235294117646,"y":913.3088235294118},{"id":1,"pressure":1,"x":214.11764705882354,"y":366.69117647058823}],"action":2},{"events":[{"id":0,"pressure":1,"x":505.88235294117646,"y":913.3088235294118}],"action":1},{"events":[{"id":0,"pressure":1,"x":505.88235294117646,"y":913.3088235294118},{"id":1,"pressure":1,"x":214.11764705882354,"y":366.69117647058823}],"action":262}],"eventType":"MOTION"}
最佳答案
您可以使用 adb getevent
和 sendevent
来完成。
使用 adb
连接您的设备。按照以下步骤操作。
识别您的输入设备:
在您的设备上打开任何图像。要列出输入设备,请运行
$ adb shell getevent
add device 1: /dev/input/event7
name: "msm8226-tapan9302-snd-card Headset Jack"
add device 2: /dev/input/event6
name: "msm8226-tapan9302-snd-card Button Jack"
add device 3: /dev/input/event2
name: "synaptics_dsx_i2c"
add device 4: /dev/input/event4
name: "qpnp_pon"
放大/缩小图像,您应该看到一些连续的日志,如
/dev/input/event2: 0003 0030 00000005
/dev/input/event2: 0000 0000 00000000
/dev/input/event2: 0003 002f 00000000
/dev/input/event2: 0003 0036 00000144
/dev/input/event2: 0003 003a 00000079
/dev/input/event2: 0000 0000 00000000
/dev/input/event2: 0003 0036 00000142
确认 /dev/input/event2
是我的目标设备的输入设备名称。
获取准确的getevent
并将getevent
转换为sendevent
:
确保您的屏幕已打开并打开了一些图像,
在提示符下运行以下命令。
$ adb shell getevent | grep dev/input/event2 > getevent_input.txt
当上述程序运行时,在您手机上的图像上捏合/捏合。
完成后,终止上述命令 Ctrl + C
打开文件 getevent_input.txt
并从中删除第一行 "add device X:/dev/input/eventX"
。
由于 getevent
返回十进制值,而 sendevent
获取十六进制值。
我们要做上面的转换。
此脚本 hex_to_dec.py
这是工作。感谢this家伙!
$./hex_to_dec.py getevent_input.txt
生成文件getevent_input.scr
,现在将此文件重命名为.sh
$ mv getevent_input.scr sendevent_input.sh
打开文件sendevent_input.sh
,删除第二行"echoing – drawing function"
并保存。
在设备上运行。
传输 sendevent_input.sh
到设备。
$ adb push sendevent_input.sh /sdcard/
1615 KB/s (64379 bytes in 0.038s)
确保您的设备已打开图像,并且屏幕未关闭。
$ adb shell sh /sdcard/sendevent_input.sh
对我来说非常好,如果这就是你要找的。
对于可见的结果,启用 Show touches
在开发人员选项中。
环境:Motorola Moto G (Android 4.4.4)
在 Ubuntu 12.04
上使用 ADB (v 1.0.31)
。
关于android - 使用 adb 向 Android 手机发出捏合/捏合命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25363526/
我试图弄清楚为什么我的缩放在我的 OpenGL 相机上表现得很奇怪。它的目的是放大和缩小,但它的缩放非常随机。 这是我的代码: - (void)pinchDetected:(UIPinchGestur
我有一个带有 pdf 文件的 UIWebView。效果很好。但是我怎样才能启用pdf文件的缩放呢? 最佳答案 确保选中“缩放页面以适合” 关于pdf - 在 UIWebView 上启用缩放/捏合,我们
我使用 Ionic4 和 Angular8。 我想在智能手机上捏合/捏合屏幕。 我试过的以下说明已添加到 index.html。 但事与愿违,在真机上并没有运行。 我也试过了。 以下已添加到 . s
我有一个使用 canvas.drawLine 方法绘制图形的 onDraw 开发的运行图形库。在 onTouch 中,我实现了滚动功能。 现在我的客户想要缩放/捏合。是否可以在不重新绘制这些操作的情况
我被 UIScrollView 的问题困住了 我想在用户点击特定点时缩放 ScrollView ,并防止用户使用捏缩放手势放大/缩小,我该怎么做? [imgScroll setDelegate:sel
我的 map View 有一个 OnZoomListener,只要缩放比例发生变化,它就会被调用。这适用于底部的加号或减号按钮用于更改缩放比例的任何时候。但是,如果用户使用双指缩放来放大或缩小,则永远
我有一个 UITextView,可以在 UIImageView 中使用手势缩放、旋转和调整大小。当我缩放或调整它的大小然后输入一些文本时,文本容器会改变大小并且文本被截断。我尝试更改文本的大小以调整其
在 iPhone 上我只是这样做(而且它完美地工作): view.transform = CGAffineTransformRotate(transform, [(UIRotationGestureR
我已经从资源包中的 UIWebView 中加载了一个 PDF 文件。 现在,我无法缩放/收缩 PDF 文件。 我找到了以下 2 个相关链接,但没有一个答案被标记为正确 - How to zoom we
我正在做一个图像处理项目,我需要通过平移来拖动图像,通过旋转来旋转图像,通过捏合手势使图像变小和变大,最后通过双击禁用所有手势。如何实现这一目标,因为我对 Android 开发还很陌生。 提前致谢 最
我正在尝试将具有特定位置的 div(“childItem”)覆盖在具有背景图像的较大 div(“parentContainer”)之上。然后我使用 iscroll 允许在父 div 上捏合/缩放。这行
在 android 平板电脑上用谷歌浏览器打开的 html 页面上,我需要捕捉该用户已经做了一些放大(捏合)并在几秒钟后将其重置为默认值。 (缩小到默认屏幕大小。但我不想完全阻止缩放,我想允许它,但一
下面通过图文并茂的方式给大家分享下IOS手势操作(拖动、捏合、旋转、点按、长按、轻扫、自定义)的相关内容。 1、UIGestureRecognizer 介绍 手势识别在 iOS 中非常重要,他极大
谁能指导如何在 Angular 2 RC2 中使用移动手势。 可能是这样的: 从API可以看出 HAMMER_GESTURE_CONFIG HammerGestureConfig 下 @angula
不久前我在一家帆船公司制作了一个 WordPress 网站,xssailing.com并且当前将视口(viewport)设置为: 该站点在计算机上运行良好,我可以在 iPhone/iPad 上进行缩
ios 七种手势操作 今天为大家介绍一下ios 的七种手势,手势在开发中经常用到,所以就简单 通俗易懂的说下, 话不多说,直接看代码: 1、uigesturerecognizer 介绍 手势识
目前我正在尝试创建某种图像查看器,您可以在其中单击图像,然后以全尺寸显示该图像。现在我想给它添加手势来缩放。我想了解并查看如何添加捏合手势来放大和缩小,以便能够在图像周围平移并使用双击手势快速放大。我
我正在尝试使 ImageView 像 Instagram 故事帖 subview 一样工作。我在 UIImageView 上添加了 UIPinchGestureRecognizer、UIPanGest
我是一名优秀的程序员,十分优秀!