android 禁止多点触摸事件,Android:Android 1.6 SDK支持多点触控事件处理?(Android:Multi touch event handling is supported ...

Android:Android 1.6 SDK支持多点触控事件处理?(Android:Multi touch event handling is supported in Android 1.6 SDK?)

朋友们,

我想知道使用哪个版本的Android SDK我们可以开发多点触控处理。 Android SDK 1.6是否支持多点触控? 如果是的话,我可以获得一些示例代码,我可以在屏幕上放置多个图像按钮并一次点击所有图像按钮应检测多个触摸事件吗?

谢谢。

Friends,

I like to know using which version of Android SDK we can develop multi touch handling. Does Android SDK 1.6 support multi touch? If yes, can i get some sample code, where i can have multiple imagebuttons placed on screen and clicking on all the imagebuttons at a time should detect multiple touch events?

Thank you.

原文:https://stackoverflow.com/questions/2457334

更新时间:2020-01-13 11:11

最满意答案

我认为这是2.1的更新。 你为什么要在这一点上尝试1.6?

I think its an update with the 2.1. Why do you want to try on 1.6 at this point any way?

2010-03-16

相关问答

触摸事件的最佳主跟踪(除了多点触摸! - 以上回答)似乎是: http://quirksmode.org/mobile/tableTouch.html 现在,Android 2.1可以让你捏/缩放,但就是这样。 没有细微的多点触控追踪,就像你在iPhone上一样。 更新:2011年5月 - Android蜂窝3.0和3.1浏览器现在有适当的多点触控 The best master tracking for touch events (other than multi-touch! - answer

...

你必须使用TouchEvent #touchPointID来识别触摸点,存储它并在你的循环中你可以对所有这些触点进行命中测试。 protected var m_oTouchIDs:Object = {};

protected function onTouchBegin(e:TouchEvent):void

{

m_oTouchIDs[e.touchPointID] = new Point(e.localX, e.localY);

}

protected function onTouc

...

好吧,我找到了答案,使用MotionEventCompat我能够通过添加索引并通过MotionEventCompat接口传递事件来实现所需的行为。 int index = MotionEventCompat.getActionIndex(motionEvent);

int x = (int) MotionEventCompat.getX(motionEvent, index);

int y = (int) MotionEventCompat.getY

...

在你的清单中: 在 ,添加“ android:installLocation="preferExternal “ 保持你当前uses-sdk为“ ” 然后转到Project> Properties> Android(在左侧),将构建目标更改为2.2,并且您已完成设置。 您的项目将使用2.2构建(但仍然只需要1.6),但运行1.6的设备将简单地忽略清单中新的“installLocation”设置。 只要注意

...

我认为这是2.1的更新。 你为什么要在这一点上尝试1.6? I think its an update with the 2.1. Why do you want to try on 1.6 at this point any way?

这里是检查是否有摄像头的代码( https://developer.android.com/guide/topics/media/camera.html ): /** A safe way to get an instance of the Camera object. */

public static Camera getCameraInstance(){

Camera c = null;

try {

c = Camera.open(); // attempt t

...

你需要处理检测另一个手指。 更具体的处理 MotionEvent.ACTION_POINTER_DOWN和MotionEvent.ACTION_POINTER_UP 否则你会忽略其他手指。 以下是我的一个项目中的一些代码,它们正是您正在寻找的内容: public void onTouchEvent(MotionEvent event)

{

int ptrId = -1;

int action = event.getAction();

switch (action & Mot

...

我确实更新并下载了android 1.6 SDK,并且能够清理项目,一切正常。 I did update and downloaded android 1.6 SDK and was able to clean the project and everything worked fine.

补充预览答案。 android尽可能自动向上兼容你的代码(并非总是如此)。 但降低应用程序的api级别。 可以是从简单到噩梦执行的任务 ,一切都取决于你的代码是否使用了很多特定的2.2 ......这意味着在你的项目中更改API级别或android.jar可能远远不够。 祝你好运 Complement preview answers. android make upward compatible your code automatically as much as possible (not al

...

请确保您不要混淆最低SDK版本和目标SDK版本,因为这些是不同的选项。 例如,我在清单的应用程序中使用以下设置:

文档说明了有关targetSdkVersion : 在某些情况下,这允许应用程序使用目标API级别中定义的清单元素或行为,而不是仅限于使用为最低API级别定义的清单元素或行为。 因此,通过指定4的targetSdkVersion ,但minimumSd

...

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值