android 发现屏幕上的压力
我想粗略地了解手指在安卓电容屏上按压的压力大小。我的想法是获取手指触摸时覆盖的区域(可能需要一些额外的参数来使其更准确,但这就是主要思想)。
那么,有什么办法可以找到被覆盖的内容呢? (例如获取覆盖的像素数)。
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).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
只有 MotionEvent.getPressure() (您可能已经找到了)。我怀疑有什么东西可以报告手指覆盖了多少像素。
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.
我不太清楚,但你可以使用以下功能:
压力将在 0 和 1 之间,从 0 = 无压力,到 1 = 正常压力,但它可以大于 1...
你的东西完全是 NIH。 ..使用已经存在的东西?或者也许它不能满足您的需求!
I do not really know but you have access to the following function :
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 !
您可以使用 MotionEvent.getSize() 获取被按下的屏幕区域的标准化值(从 0 到 1)。该值与按下的像素数相关。
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.