how to detect if the screen is capacitive or resistive in an Android device?

后端 未结 2 2054
生来不讨喜
生来不讨喜 2021-01-05 18:02

I am developing an application that will behave slightly different depending on the type of screen. Is there any way to detect it?

2条回答
  •  独厮守ぢ
    2021-01-05 18:07

    I have a small trick to do it but requires a canvas. Just detecting in a motionEvent if

    event.getPressure() > 0 then is capacitive ; event.getSize() > 0 then is resistive

    the problem is I dont want to use a canvas just for detecting it :(

提交回复
热议问题