[英]how to detect if the screen is capacitive or resistive in an Android device?
I am developing an application that will behave slightly different depending on the type of screen. 我正在开发一个应用程序,根据屏幕类型的不同,它会略有不同。 Is there any way to detect it?
有没有办法检测它?
android.content.res.Configuration
contains a value called touchscreen
, which could be TOUCHSCREEN_STYLUS
(=resistive), TOUCHSCREEN_FINGER
(=capacitive), TOUCHSCREEN_NOTOUCH
(=no touch screen), TOUCHSCREEN_UNDEFINED
(=uh oh). android.content.res.Configuration
包含一个名为touchscreen
的值,可以是TOUCHSCREEN_STYLUS
(=电阻), TOUCHSCREEN_FINGER
(=电容), TOUCHSCREEN_NOTOUCH
(=无触摸屏), TOUCHSCREEN_UNDEFINED
(=呃哦)。
EDIT: I got Dianne'd again :) So - bottom line, it seems like there is no way to get the actual physical properties of the screen. 编辑:我再次得到Dianne :)所以 - 底线,似乎没有办法获得屏幕的实际物理属性。 I guess your best bet is to have a setting to allow users to switch between your two modes.
我想你最好的选择是让用户在两种模式之间切换。
I have a small trick to do it but requires a canvas. 我有一个小技巧,但需要一个画布。 Just detecting in a motionEvent if
只是在motionEvent中检测是否
event.getPressure() > 0 then is capacitive ; event.getPressure()> 0然后是电容性的; event.getSize() > 0 then is resistive
event.getSize()> 0然后是电阻性的
the problem is I dont want to use a canvas just for detecting it :( 问题是我不想使用画布只是为了检测它:(
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.