Android的多点触控? [英] Android multitouch?

查看:99
本文介绍了Android的多点触控?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为一个开发者,我倾向于第一个方案然后再研究。我试图实现一个屏幕,将处理多个用户输入。基本上,映射不止一个手指。我想两件事情。

As a developer, I tend to program first then research later. I was trying to implement a screen that would handle multiple user inputs. Basically map more than just one finger. I tried two things..

我有一种实现OnTouchListener一个Activity类。在这里,我有添加了活动作为自己的ontouch听众两个独立的子视图。然后,我有这样打印出来的event.getPointerCount(),并打印出每个指针的位置打印线。

I had an Activity class that implemented OnTouchListener. Here I had two separate child views that added the Activity as their ontouch listeners. And then I had a print line that printed out the event.getPointerCount() and printed out the location of each of the pointers..

其下载到手机上,并对其进行了测试。我注意到,指针永远长不大大于二。我甚至注意到,如果一个人的手指是在一个孩子,另一个手指放在其他的孩子认为事件只发到了第一个孩子组成部分。接下来,我试图把单独的侦听器在每个子组件,看看是否会工作,但其作用是一样的。

Downloaded it to the phone and tested it. I noticed that the pointers never grew greater than two. I even noticed if one finger was on one child and another finger on the other child view that the events only made it to the first child component. Next I tried to put separate listeners on each of the child components to see if that would work but it acted the same.

所以,似乎在与触摸屏的用户输入处理了Android只支持一共有两个用户输入。

So, it seems that the android only supports a total of two user inputs when dealing with inputs from the user touching the screen.

这是真的吗?似乎从测试和研究,这是这种情况。

Is this true? It seems from testing and research that this is the case.

有没有人遇到了这个限制。任何巧妙的变通?

Has anyone ran into this limitation. Any clever work arounds?

感谢您的时间和响应。

Thanks for you time and responses.

DK

推荐答案

支持触摸点的数量取决于设备。在Android系统当前所有可用版本 MotionEvent ,则发送到单个目标视图,并描述了当前所有活动联系点的状态。目标视图是其中第一个 MotionEvent.ACTION_DOWN 事件发生时确定的。

The number of touch points supported is dependent on the device. In all currently available versions of Android MotionEvents are sent to a single target view and describe the state of all currently active touch points. The target view is determined by where the first MotionEvent.ACTION_DOWN event occurs.

见多点触摸对Android开发岗位决策意识博客与Android上的多点触控事件工作的简要概述。

See the post Making Sense of Multitouch on the Android Developers blog for a quick overview of working with multitouch events on Android.

这篇关于Android的多点触控?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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