Detecting touch pressure on a capacitive touch screen?

I heard about:

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

But that only returns 0 without touching and 1 when my finger touches the screen.

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

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

+4
source share
1 answer

MotionEvent().getPressure(i) should return a value from 0 to 1 based on the "pressure" set on the screen. In fact, for capacitive screens, this is the size of a capacitive object, not literal pressure, but the concept is almost the same for fingers (fingers are soft). Ranges greater than one may be returned depending on the calibration of the touch screen.

If your screen returns only 0 or 1, try testing on another device. Perhaps your screen driver simply does not return these values.

MotionEvent | Android Developers: getPressure ()

+6
source

Source: https://habr.com/ru/post/1490417/


All Articles