有没有办法在 Android 模拟器上测试多点触控?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2825505/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 07:31:43  来源:igfitidea点击:

Is there any way to test multi-touch on the Android Emulator?

androidandroid-emulatorpinchzoom

提问by Pritam

Can multi-touch events be tested on the Android Emulator? Or is there any way to test this without an actual device? I am using the 2.0 sdk and want to test zoom-in/zoom-out with two fingers.

可以在 Android 模拟器上测试多点触控事件吗?或者有没有办法在没有实际设备的情况下进行测试?我正在使用 2.0 sdk 并想用两个手指测试放大/缩小。

采纳答案by Stephan Branczyk

UPDATE:

更新:

Yes, now there is (not for the 2.x Android, but the latest ones).

是的,现在有(不是针对 2.x Android,而是最新的)。

In case people still searching with this function, if you are using default emulator from android studio, for mac user you can hold command button, and for windows/linux i believe it is alt button while left clicking with your mouse – HendraWD

如果人们仍在使用此功能进行搜索,如果您使用的是 android studio 的默认模拟器,对于 mac 用户,您可以按住命令按钮,对于 windows/linux,我相信它是 alt 按钮,同时用鼠标左键单击 – HendraWD

And for Linux, it's Ctrl + left click (however, I don't know if it's the same on Windows, so HendraWD may be right about that one)

对于 Linux,它是 Ctrl + 左键单击(但是,我不知道在 Windows 上是否相同,因此 HendraWD 可能是正确的)

Plus another thing you can do (with Android 4.0+) is pipe touch events through one device into the emulator. This is helpful if you only have one device, but would like to test those same touch events on other versions/dimensions of Android. (See http://tools.android.com/tips/hardware-emulation)

另外您可以做的另一件事(使用 Android 4.0+)是通过一个设备将触摸事件通过管道传输到模拟器中。如果您只有一台设备,但想在其他版本/维度的 Android 上测试这些相同的触摸事件,这将很有帮助。(参见http://tools.android.com/tips/hardware-emulation

In any case, these are just workarounds, if multitouch is important for your app, I would still recommend that you go to an Android Developer user group with your laptop and ask for help to test your app on the spot. Your fellow developers can be super helpful with this.

无论如何,这些只是解决方法,如果多点触控对您的应用程序很重要,我仍然建议您带着笔记本电脑前往 Android 开发人员用户组,寻求帮助以现场测试您的应用程序。您的开发人员同事对此可能会非常有帮助。

In my groups, we share phones all the time (especially since most of us don't own all the different Android handsets out there). And if you don't have an Android user group in your area, assuming you live in a large enough metropolitan area, consider possibly starting such a group yourself. You're most likely not the only one who will need help with this stuff.

在我的小组中,我们一直共用手机(特别是因为我们中的大多数人并不拥有所有不同的 Android 手机)。如果您所在地区没有 Android 用户组,假设您居住在一个足够大的大都市区,可以考虑自己创建一个这样的组。您很可能不是唯一需要帮助处理这些事情的人。

回答by Jim Leask

I finally discovered how to do a pinch-zoom on the Android emulator for Android Studio 3.2. This was hard to find, but hope it helps someone.

我终于发现了如何在 Android Studio 3.2 的 Android 模拟器上进行缩放。这很难找到,但希望它可以帮助某人。

  • move your mouse to where you want the centre of the pinch zoom. (do NOT press the mouse button)
  • press SHIFT (do not press the mouse button)
  • press Command (do not press the mouse button)
  • you should see a round target under your mouse (you haven't pressed the mouse button yet, have you)
  • move your mouse away from this first location to where you want your second "finger"
  • now you can press/drag your mouse to do the pinch/zoom
  • 将鼠标移动到您想要捏合缩放的中心的位置。(不要按鼠标按钮)
  • 按 SHIFT(不要按鼠标按钮)
  • 按命令(不要按鼠标按钮)
  • 您应该会在鼠标下方看到一个圆形目标(您还没有按下鼠标按钮,是吗)
  • 将鼠标从第一个位置移到您想要第二个“手指”的位置
  • 现在您可以按下/拖动鼠标来进行捏合/缩放

That was easy - or not.

那很容易——或者不是。

回答by Manolo Garcia

Now is possible with the new version of the emulator.

现在可以使用新版本的模拟器。

To use the multi-touch feature, hold down the Alt key on your keyboard and right-click your mouse to center the point of reference or click & drag the left mouse button to zoom.

要使用多点触控功能,请按住键盘上的 Alt 键并右键单击鼠标以将参考点居中或单击并拖动鼠标左键进行缩放。

http://tools.android.com/tips/hardware-emulation

http://tools.android.com/tips/hardware-emulation

http://android-developers.blogspot.nl/2016/02/android-studio-20-beta.html

http://android-developers.blogspot.nl/2016/02/android-studio-20-beta.html

回答by Chintan Soni

Happy to know that we got Multi-touch emulators in Android too, so took this opportunity to make Androiders aware who is not yet.

很高兴知道我们在 Android 中也有多点触控模拟器,所以借此机会让 Android 用户知道谁还没有。

You can test it by making following updates to your current development tools:

您可以通过对当前开发工具进行以下更新来测试它:

  1. updated my Android Studio from 2.0 preview 4 to 2.0 preview 5.
  2. updated my Android SDK tools to 25.0.2 rc3
  3. Updated my Android 6.0 Google APIs Intel x86 Atom_64 System Image to Revision 12
  4. Project level dependency to classpath 'com.android.tools.build:gradle:2.0.0-alpha5'
  1. 将我的 Android Studio 从 2.0 预览版 4 更新为 2.0 预览版 5。
  2. 将我的 Android SDK 工具更新为 25.0.2 rc3
  3. 将我的 Android 6.0 Google APIs Intel x86 Atom_64 System Image 更新为 Revision 12
  4. 项目级依赖于类路径 'com.android.tools.build:gradle:2.0.0-alpha5'

PS:PLEASE DO NOT UPDATE NOW, as it contains a bug I have spotted one. And its a serious bug. It is interfering in our development routines. You might want to checkout my question here.

PS:请不要现在更新,因为它包含一个我发现的错误。这是一个严重的错误。它正在干扰我们的开发程序。您可能想在这里查看我的问题。

回答by Paul Lammertsma

Since ADT 17, it is possible to use a physical Android 4.0 device to send multitouch gestures to the emulator. See Android's instructions here.

从 ADT 17 开始,可以使用物理 Android 4.0 设备向模拟器发送多点触控手势。请参阅此处的 Android 说明。

回答by Gaurav Vaish

No.

不。

AFAIK, The emulator still does not have any multi-touch detection driver (saw the code at https://android.googlesource.com).

AFAIK,模拟器仍然没有任何多点触控检测驱动程序(在https://android.googlesource.com看到代码)。

回答by Vikas

Xamarin android player has multi touch option enabled.

Xamarin android 播放器启用了多点触控选项。

Source: https://developer.xamarin.com/guides/android/getting_started/installation/android-player/

来源:https: //developer.xamarin.com/guides/android/getting_started/installation/android-player/

It is possible to simulate two-finger multi-touch input by holding the Alt/Option key and clicking on the screen.

可以通过按住 Alt/Option 键并单击屏幕来模拟两指多点触控输入。

To simulate a pinch-zoom press and hold the Alt/Option button and drag towards the centre of the screen (for zoom out) or away from the centre of the screen (for zoom in).

要模拟双指缩放,请按住 Alt/Option 按钮并拖向屏幕中心(用于缩小)或远离屏幕中心(用于放大)。

To simulate a two finger drag hold the Alt/Option + Shift while clicking and dragging on the screen.

要模拟两指拖动,请在单击和拖动屏幕时按住 Alt/Option + Shift。

回答by yourstruly

For me on ubuntu double mouse click was working. First left click + fast left click and hold while moving mouse.

对我来说,在 ubuntu 上双击鼠标是有效的。首先左键单击 + 快速左键单击并在移动鼠标时按住。

enter image description here

在此处输入图片说明