Android - Detect Touch Pressure on capacitive touch screen?

前端 未结 1 1841
深忆病人
深忆病人 2021-02-15 13:34

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.

相关标签:
1条回答
  • 2021-02-15 14:10

    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.

    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 Developers : getPressure()

    0 讨论(0)
提交回复
热议问题