前言
关于自定义键盘搜索了一下,网上基本上是通过android.inputmethodservice.Keyboard
实现的,但是打开Google文档却发现在Android Q
中这个类将被废弃。
This class is deprecated because this is just a convenient UI widget class that application developers can re-implement on top of existing public APIs. If you have already depended on this class, consider copying the implementation from AOSP into your project or re-implementing a similar widget by yourselves.
通过Keyboard实现自定义是很容易的,只需要自定义键盘xml即可:
|
|
这种自定义键盘的方式存在着很多缺点(更准确的说应该是很多不足):
- 在Android Pad上面的支持有问题。
- 不能够实现动态更改键盘顺序和位置,或者动态控制和隐藏部分键。