onTouch MotionEvent的getTouchMinor和getTouchMajor始终是完全相同的数字结果,为什么? [英] onTouch MotionEvent getTouchMinor and getTouchMajor always the exact same number result, why?

查看:389
本文介绍了onTouch MotionEvent的getTouchMinor和getTouchMajor始终是完全相同的数字结果,为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从文档中可以看到,触摸主要和触摸次要是触摸事件的椭圆轴.一个是对触摸区域的长度进行最长的测量,另一个是对触摸事件的最短进行的测量.就像椭圆的测量.

Looking at the documentation, the touch major and touch minor are axis of the ellipse for the touch event. one is for the length of the touch area longest measurement and the other for the shortest of the touch event. like the measurement of an ellipse.

但是,我在几个Android平板电脑上针对getTouchMajor和getTouchMinor方法测试了此代码.然后将手指放下,以使触摸屏幕的表面积在一个方向上变长,因此不会是圆形.这样,最大和最小数字不应相同.

however, i tested this code for getTouchMajor and getTouchMinor methods on several android tablets. and did this with putting my finger down so that the surface area touching the screen would be longer in one direction so it would not be a circle. this way the max and min numbers should not be the same.

问题在于,无论在触地事件中触摸屏幕的区域是什么形状,两者的浮点数始终完全相同.唯一可行的方法是触摸屏幕的手指皮肤区域是一个圆圈.

the problem is that no matter what shape the area that is touching the screen in the on touch down event, it always is the exact same float number for both. the only way for this to be possible is if the finger skin area touching the screen is a circle.

因此,基本上,我将两块Android平板电脑将触摸的触摸事件区域视为圆形区域,有时更大或更小,但是始终使其呈圆形,那里有没有可以给您更精确形状的设备?

so basically, the two android tablets I have treat the touch event area of touch as a circle shaped area, sometimes larger or smaller, however always makes it circle shaped, is there any device out there that gives you a more accurate shape?

从这些功能中获得的唯一有用信息就是触摸区域的总体大小.

the only good information I get from these functions is the general size of the touch area.

为什么两个数字都相同.这不是正确的结果吗?

why are both the numbers the same. and is this not the correct result?

if(event.getAction() == MotionEvent.ACTION_DOWN){
        float x = event.getX();
        float y = event.getY();
        float touchMajor = event.getTouchMajor(); // major axis of ellipse touch area
        float touchMinor = event.getTouchMinor(); // minor axis of ellipse touch area 

      //  Toast.makeText(context, "x " +  x , Toast.LENGTH_SHORT).show();
      // Toast.makeText(context, "y " +  y , Toast.LENGTH_SHORT).show();
        Toast.makeText(context, "touchMajor " + touchMajor , Toast.LENGTH_SHORT).show();
        Toast.makeText(context, "touchMinor " +  touchMinor , Toast.LENGTH_SHORT).show();

推荐答案

我的项目组和我对同一件事都感兴趣(我们发布了以下内容:

My project group and I are interested in the same thing (we posted this: Android finger detection - Orientation and ellipse )

我们发现了一些暗示性的评论,即大多数设备的触摸屏驱动程序可能不会将此数据提供给系统.

We have found suggestive comments that maybe the touch screen drivers for most devices do not provide this data to the system.

我们现在已经测试: 三星Galaxy S2,HTC One,Nexus 5(由LG制造)和Nexus 7(由Asus制造),三星Galaxy Tap3

We have now tested: Samsung Galaxy S2, HTC One, Nexus 5 (by LG) and Nexus 7 (by Asus), Samsung Galaxy Tap3

当我们测试Samsung Galaxy Tap 3时,最终我们得到了不同的getTouchMajor()和getTouchMinor()值,但是喜悦只是短暂的,因为我们发现在任何情况下getTouchMajor()= getTouchMinor()* 3,和其他所有设备一样,getOrientation()始终为0.

As we tested the Samsung Galaxy Tap 3, we finally we got different values for getTouchMajor() and getTouchMinor(), but joy was only brief as we found that getTouchMajor() = getTouchMinor() * 3, in any scenario, and getOrientation() was always 0, as with all the other devices.

我们的结论是,大多数设备不支持getTouchMajor(),getTouchMinor().或getOrientation(). 这很可能是电容式触摸屏的局限性.

Our conclusion is that most devices do not support, getTouchMajor(), getTouchMinor(). or getOrientation(). This is most likely a limitation of the capacitative touch screens.

基于FTIR(沮丧的全内反射)或DI(漫射照明)的触摸表面等基于图像处理的方法已显示出更多的触摸交互数据.但是据我们所知,这些方法都根本不适用于移动技术,并且没有手持设备使用这两种方法.

Methods such as FTIR (Frustrated Total Internal Reflection) or DI (Diffuse Illumination) based touch surfaces, which are image processing based have shown to give more rich data of the touch interaction. But as far as we know none of these methods are at all applicable on mobile technology, and no handheld device is using either of these.

我们震惊地发现,无法在手持设备上追求这些指标的可能性.

We were devasted to see that the possibilities with these metrics on handheld devices cannot be pursued.

我最近刚从我的一位同事那里发现,当您在开发人员设置下激活Input> Pointer Location时,三星生产的 Google Nexus 10 会显示带有方向线的椭圆.

I just recently discovered through co-students of mine, that the Samsung produced Google Nexus 10 shows an ellipse with a direction line, when you activate Input>Pointer Location under developer settings.

这向我表明某些设备确实在getTouchMinor和getTouchMajor以及方向上交付. (或相同功能的历史版本). 我自己没有机会为该设备编写任何代码,但这似乎是合理的.

This indicates to me that some devices do deliver on getTouchMinor and getTouchMajor as well as orientation. (or historical versions of the same functions). I have not had the chance to code anything for the device myself but it seems plausible.

这篇关于onTouch MotionEvent的getTouchMinor和getTouchMajor始终是完全相同的数字结果,为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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