Touch devices (iOS, Android)

寵の児 提交于 2019-12-01 08:07:20

Well, that entirely depends on the API. Android, for example, has a getPressure() accessor in MotionEvents that returns a float between 0.0f and 1.0f, but the actual granularity of your result obviously depends on the hardware - if the screen can only detect "pressed" vs "non-pressed", you will only ever get 0.0f or 1.0f.

EDIT: As per Julio Gorgé's answer, iOS does not offer this functionality.

EboMike already answered correctly your question regarding Android devices. For iOS, I can say it does not expose touch pressure information through public APIs at this moment.

picciano

There's a workaround for iOS. See my answer in Tap pressure strength detection using accelerometer

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