android: how can I verify, that device support multitouch?

落爺英雄遲暮 提交于 2019-11-30 01:17:43

问题


How can I verify, that device support multitouch event? If device have resistent display, multitouch is not possible. Is that way to find out, what kind of display is in device, or if device support multitouch?

Thanks.


回答1:


If you need multitouch, include:

<uses-feature android:name="android.hardware.touchscreen.multitouch" />

in your manifest. Your application will not be listed in the Market for devices that lack multitouch.

If you wish to conditionally support multitouch, use PackageManager and hasSystemFeature() to see if android.hardware.touchscreen.multitouch is available.




回答2:


A quick example:

boolean multi = 
getPackageManager().hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH);



回答3:


You can use PackageManager.hasSystemFeature with PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH

There is an interesting series of articles on Android multi-touch that are worth a look

Hope this helps,

Phil Lello




回答4:


public final String SUPPORT = "Supported";
public final String NOT_SUPPORT = "None";

if (getPackageManager().hasSystemFeature(
                PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH)) {
            aDisplayInfo.multiTouch = SUPPORT;
        } else {
            aDisplayInfo.multiTouch = NOT_SUPPORT;
        }


来源:https://stackoverflow.com/questions/5584977/android-how-can-i-verify-that-device-support-multitouch

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