本文介绍了多键presses为Android 2.X的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是比较新的这个寂静的,我一直在开发一个小应用程序,将来自用户能够preSS 2个按钮在同一时间大大受益。什么是实现这一目标的最佳方法是什么?我不认为一个OnClickListener就像这一点,我已经看到了例子有OnTouch事件这样做。但是,我不知道如何设置按钮presses与OnTouch事件。

I am relatively new to this still, and I have been developing a small app that would benefit greatly from a user being able to press 2 buttons at one time. What is the best method for achieving this? I dont think that an OnClickListener works like that, and I have seen examples for doing this with an OnTouch event. However, I do not know how to set up button presses with an OnTouch event.

推荐答案

您将不得不自己处理触摸事件。与多指针(又名多点触控)API,它很容易。刚刚覆盖的onTouchEvent()方法,或在您的按钮注册一个OnTouchListener。

You would have to handle touch events yourself. With the multi-pointers (aka multi-touch) API it's very easy. Just override the onTouchEvent() method or register an OnTouchListener on your buttons.

这篇关于多键presses为Android 2.X的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-17 14:56