简体   繁体   English

Android-在电容式触摸屏上检测触摸压力?

[英]Android - Detect Touch Pressure on capacitive touch screen?

I've heard of: 我听说过:

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

But this only returns 0 for no touch, and 1 when my finger touches the screen. 但这只会返回0(无触摸),返回1(当我的手指触摸屏幕时)。

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) should return a value between 0 and 1 based on the "pressure" placed on the screen. MotionEvent().getPressure(i)应基于屏幕上的“压力”返回0到1之间的值。 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. 根据触摸屏的校准,可能会返回大于1的范围。

If your screen is only returning 0 or 1, try testing on another device. 如果您的屏幕仅返回0或1,请尝试在另一台设备上进行测试。 Perhaps your screens driver simply does not return those values. 也许您的屏幕驱动程序根本不返回那些值。

MotionEvent | MotionEvent | Android Developers : getPressure() Android开发人员:getPressure()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM