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

时间:2021-09-14 18:53:35

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,并希望用两根手指测试放大/缩小。

6 个解决方案

#1


18  

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工作室的默认模拟器,对于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 Developer用户组,并寻求帮助以便当场测试您的应用程序。您的开发人员可以对此非常有帮助。

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用户组,假设您住在一个足够大的都市区,请考虑自己开始这样一个组。你很可能不是唯一一个需要帮助的人。

#2


6  

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://android-developers.blogspot.nl/2016/02/android-studio-20-beta.html

#3


2  

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说明。

#4


2  

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中也有多点触控模拟器,所以借此机会让Androiders知道谁还没有。

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. 将我的Android Studio从2.0预览版4更新为2.0预览版5。

  3. updated my Android SDK tools to 25.0.2 rc3
  4. 将我的Android SDK工具更新为25.0.2 rc3

  5. Updated my Android 6.0 Google APIs Intel x86 Atom_64 System Image to Revision 12
  6. 将我的Android 6.0 Google API英特尔x86 Atom_64系统映像更新到版本12

  7. Project level dependency to classpath 'com.android.tools.build:gradle:2.0.0-alpha5'
  8. 项目级别依赖于类路径'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:请不要现在更新,因为它包含我发现的一个错误。这是一个严重的错误。它干扰了我们的开发程序。你可能想在这里查看我的问题。

#5


2  

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上的代码)。

#6


1  

Xamarin android player has multi touch option enabled.

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

Source: 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。

#1


18  

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工作室的默认模拟器,对于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 Developer用户组,并寻求帮助以便当场测试您的应用程序。您的开发人员可以对此非常有帮助。

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用户组,假设您住在一个足够大的都市区,请考虑自己开始这样一个组。你很可能不是唯一一个需要帮助的人。

#2


6  

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://android-developers.blogspot.nl/2016/02/android-studio-20-beta.html

#3


2  

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说明。

#4


2  

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中也有多点触控模拟器,所以借此机会让Androiders知道谁还没有。

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. 将我的Android Studio从2.0预览版4更新为2.0预览版5。

  3. updated my Android SDK tools to 25.0.2 rc3
  4. 将我的Android SDK工具更新为25.0.2 rc3

  5. Updated my Android 6.0 Google APIs Intel x86 Atom_64 System Image to Revision 12
  6. 将我的Android 6.0 Google API英特尔x86 Atom_64系统映像更新到版本12

  7. Project level dependency to classpath 'com.android.tools.build:gradle:2.0.0-alpha5'
  8. 项目级别依赖于类路径'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:请不要现在更新,因为它包含我发现的一个错误。这是一个严重的错误。它干扰了我们的开发程序。你可能想在这里查看我的问题。

#5


2  

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上的代码)。

#6


1  

Xamarin android player has multi touch option enabled.

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

Source: 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。