android - 如何使用 Android 模拟器使用 monkeyrunner 模拟屏幕旋转?

标签 android android-emulator rotation genymotion

我使用 monkeyrunner 脚本在 Windows 上通过 GenyMotion 模拟器测试 APK。脚本是否可能旋转模拟设备?

最佳答案

谢谢 Nir ​​H。

我在同一个文件夹中创建了脚本 - rotate.bat,代码如下:

"c:\Program Files\Genymobile\Genymotion\genyshell.exe" -c "rotation setangle %1"

并从 monkeyrunner 中将其称为(旋转 90 度并向后旋转的示例):

...

print "rotation 90"
res = os.popen('rotate 90').read()
print res

MonkeyRunner.sleep(1)

print "rotation 0"
res = os.popen('rotate 0').read()
print res

...

及其作品! :)

关于android - 如何使用 Android 模拟器使用 monkeyrunner 模拟屏幕旋转?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28516890/

相关文章:

Android 模拟器在 Ubuntu 20.04 上非常慢

python - 如何找到对象(形状)的方向? - Python Opencv

android - 服务和 BroadCastReceiver

android - SEND_SMS 权限 |对话框消息显示此应用程序可以查看短信

android - 找不到类(class)

html - CSS 垂直旋转文本 - 两侧的额外空间

android - 我可以在android中检测到两种风景吗?

android - 如何在 Android Material Design 中为 float 操作按钮创建子菜单?

javascript - Android native 浏览器中 Canvas 上的重复行

android - 模拟器 : emulator: ERROR: Missing initial data partition file: C:\Users\Miki\. android\avd\Pixel_XL_API_26.avd/userdata.img