Android-在电容式触摸屏上检测触摸压力? [英] Android - Detect Touch Pressure on capacitive touch screen?

查看:56
本文介绍了Android-在电容式触摸屏上检测触摸压力?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我听说过:

MotionEvent e;
float press = e.getPressure(...);

但这只会在没有触摸时返回0,而在我的手指触摸屏幕时返回1.

But this only returns 0 for no touch, and 1 when my finger touches the screen.

是否可以找到电容式触摸屏在手指上施加的压力值?

Is it possible to find a value for the amount of pressure your finger is putting on the screen with touch capacitive screens?

或者我的直觉是正确的,即这仅适用于电阻屏.?

Or is my hunch correct that this will only work with resistive screens..?

推荐答案

MotionEvent().getPressure(i)应该根据屏幕上放置的压力"返回0到1之间的值..实际上,对于电容屏来说,它是电容对象的大小,而不是字面上的压力,但是对于手指来说,这个概念几乎是相同的(手指是黏糊糊的).根据触摸屏的校准,可能会返回大于1的范围.

MotionEvent().getPressure(i) should return a value between 0 and 1 based on the "pressure" placed on the screen. In reality for capacitive screens it is the size of the capacitive object rather than literal pressure, but the concept is almost the same for fingers (fingers are squishy). Ranges higher than one may be returned depending on the calibration of the touchscreen.

如果屏幕仅返回0或1,请尝试在另一台设备上进行测试.也许您的屏幕驱动程序只是不返回那些值.

If your screen is only returning 0 or 1, try testing on another device. Perhaps your screens driver simply does not return those values.

MotionEvent |Android开发人员:getPressure()

这篇关于Android-在电容式触摸屏上检测触摸压力?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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