android find pressure on screen

一个人想着一个人 提交于 2019-12-04 02:29:41

问题


I would like to roughly understand the amount of pressure the finger presses on the capacitive screen on android. My idea is to get the area covered by the finger when it is touched (maybe some extra parameters to get it more accurate, but thats the main idea).

So, is there any way to find the are covered? (for example get the number of pixels covered).


回答1:


There is only MotionEvent.getPressure() (which you probably already found). I doubt that there is something that reports how many pixel are covered by the finger.




回答2:


I do not really know but you have access to the following function :

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

press will be between 0 and 1, from 0 = no pressure, to 1 = normal pressure, however it can be more then 1...

Your thing is totally NIH... Use something that already exist ? Or maybe it doesn't cover your needs !




回答3:


You can use MotionEvent.getSize() to get the normalized value (from 0 to 1) of the area of screen being pressed. This value is correlated with the number of pixels pressed.



来源:https://stackoverflow.com/questions/9312518/android-find-pressure-on-screen

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