如何在 Android 设备上模拟触摸事件? [英] How to simulate touch events on Android device?

查看:34
本文介绍了如何在 Android 设备上模拟触摸事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Android API 是否公开了用于生成触摸事件的工具,例如,在屏幕上反复模拟不同的手势以进行测试?

Does the Android API expose facilities for generating touch events, for example, repeatedly simulating different gestures on the screen for testing?

推荐答案

你可以写一个Android Instrumention Test来实现android中的UI自动测试,见测试单个活动的 UIAndroid 测试支持库.

You can write an Android Instrumention Test to implement UI auto testing in android, see Tesing UI for a Single Activity and Android Testing Support Library.

如果您不熟悉 Android 测试,我建议您阅读 Activity Testing首先.

If you are new to Android Test, I suggest you read Activity Testing first.

这篇关于如何在 Android 设备上模拟触摸事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆