1

I'd like to programmatically determine if a device is presenting a tablet or phone style keyboard. Although there are many different Android soft-keyboard implementations, there are for the most part two distinct key layouts. One for phones and the other for tablets. Thanks for your help!

Note: I'm referring to the orientation of character keys to one another. On phone keyboards, the second two rows of characters are aligned, with the first row offset by 50%. Tablet keyboard are have a much more arbitrary offset that mimics a physical keyboard layout.

4

1 回答 1

2

您对“平板电脑或手机式键盘”的概念并不反映现实。有些输入法编辑器甚至没有。“手机键盘,后两行字符对齐,第一行偏移50%”的想法,对于手机上使用的某些输入法编辑器来说可能是正确的,但肯定不是全部,当然也不是必需的。

因此,当然欢迎您通过任何标准方法(资源集Configuration等)来确定屏幕大小。但你无从得知:

  • 如果用户当前使用的输入法编辑器有键
  • 如果是这样,这些键之间的物理关系是什么(例如,“后两行字符对齐”)
于 2013-04-26T21:56:37.580 回答