[英]How do you disable animations at the system level for an android device/emulator using adb with API 23?
根据读数,值window_animation_scale
, transition_animation_scale
和animator_duration_scale
需要设置为0
以下适用于API 22,但不适用于API 23:
adb shell settings put global window_animation_scale 0.0
即使是下面的命令也不适用于API 23
adb shell content update --uri content://settings/system --bind value:s:0.0 --where 'name="window_animation_scale"'
我们希望禁用动画以防止仅出现片状视觉测试失败。 我们不希望在应用程序中引入此逻辑,因此希望在系统级而不是应用程序中应用它。
您可以执行以下adb命令来禁用动画:
adb shell settings put global window_animation_scale 0
adb shell settings put global transition_animation_scale 0
adb shell settings put global animator_duration_scale 0
此外,你可以看看这个回购
构建项目并下载生成的.apk文件,并按照该项目中提到的说明禁用动画,然后您应该顺利航行。 您还可以从许多其他来源下载相同的.apk文件(go google!)。
获得.apk文件后,发出以下命令:
adb install -r android_emulator_hacks.apk
adb shell pm grant no.finn.android_emulator_hacks android.permission.SET_ANIMATION_SCALE
adb shell am start -n no.finn.android_emulator_hacks/no.finn.android_emulator_hacks.HackActivity
应该接受Mark W的答案您也可以将其保存为shell脚本以方便使用,即:
#!/bin/sh
adb shell settings put global window_animation_scale 0.0
adb shell settings put global transition_animation_scale 0.0
adb shell settings put global animator_duration_scale 0.0
然后在终端打电话
sh path/to/file.sh
或者更进一步,在bash配置文件中保存别名快捷方式:)
检查此Bash脚本
adb shell update global set value='0.0' where name='window_animation_scale'
adb shell update global set value='0.0' where name='transition_animation_scale'
adb shell update global set value='0.0' where name='animator_duration_scale'
希望能帮助到你
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.