简体   繁体   English

android在屏幕上发现压力

[英]android find pressure on screen

I would like to roughly understand the amount of pressure the finger presses on the capacitive screen on android. 我想大致了解一下手指在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). (例如,获取覆盖的像素数)。

There is only MotionEvent.getPressure() (which you probably already found). 只有MotionEvent.getPressure() (您可能已经找到)。 I doubt that there is something that reports how many pixel are covered by the finger. 我怀疑是否有些东西会报告手指覆盖了多少像素。

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... 压力将介于0和1之间,从0 =无压力到1 =常压,但是可以大于1 ...

Your thing is totally NIH... Use something that already exist ? 您的东西完全是NIH ...使用已经存在的东西吗? Or maybe it doesn't cover your needs ! 也许它不能满足您的需求!

You can use MotionEvent.getSize() to get the normalized value (from 0 to 1) of the area of screen being pressed. 您可以使用MotionEvent.getSize()来获取被按下屏幕区域的标准化值(从0到1)。 This value is correlated with the number of pixels pressed. 该值与按下的像素数相关。

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

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