How to determine if an Android device has a touchscreen?

后端 未结 4 920
失恋的感觉
失恋的感觉 2021-02-01 02:35

I\'m spending considerable time in making my UI to work with keyboard input only. But in the end I\'m not sure whether I can rely on the assumption that Android devices all hav

4条回答
  •  我在风中等你
    2021-02-01 02:58

    Google TV (GTV) is the most popular Android notouch device (as of the time this answer is composed). However, there are several devices that will call for notouch renderings if you have "notouch" resources (e.g. a directory like res/layout-notouch/ )

    To accommodate notouch devices, made sure that focus will cause a visual selection indicator, and (for GTV) that keystroke listeners are in place for the directional-pad center button. Using default widgets and themes will often accomplish much of this automatically. If you make your own buttons, you need background 9-patches for focused and focused+pressed.

    Running on a GTV is a good test environment to make sure that notouch works well, and GTV has an emulator now, though it runs only on Linux/x86.

提交回复
热议问题