Android - Detect Touch Pressure on capacitive touch screen?

安稳与你 提交于 2020-04-10 03:34:33

问题


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.

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..?


回答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.

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()



来源:https://stackoverflow.com/questions/17540058/android-detect-touch-pressure-on-capacitive-touch-screen

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!