安卓应用专用软键盘

android app specific soft keyboard(安卓应用专用软键盘)
本文介绍了安卓应用专用软键盘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

有没有办法在 Android 上创建特定于应用的软键盘?在阅读了 InputMethodService 文档并查看了替代键盘应用程序之后,我认为替代键盘只能配置为系统范围使用(通过设置 -> 区域设置和文本).

Is there a way to create an app specific soft keyboard on Android? After reading about InputMethodService docs and checking out alternative keyboard apps out there, I figure the alternate keyboard can only be configured for system wide usage (through Settings -> Locale and Text).

如果上述问题的答案是否定的,那么是否至少有一种方法可以加载自定义字典并覆盖系统键盘的默认字典(仅当我的应用程序正在使用时)?当用户只敲击几个键时,这将有助于向用户提供非常相关的建议.

If the answer to above question is no, then is there at least a way to load a custom dictionary and override the default dictionary of the system keyboard (only when my app is in use)? That will help in giving very relevant suggestions to the user when he has only tapped couple of keys.

推荐答案

如果你只想要一个看起来和行为都像软键盘的 View,我在 我的 SmallKeyboard 类.您只需要扩展 android.inputmethodservice.KeyboardView 并决定布局.请参阅该文件末尾的 onKey 和 onText 方法,了解按键被按下时所执行的操作.

If you just want a View that looks and acts like a soft keyboard, I did that in my SmallKeyboard class. You just need to extend android.inputmethodservice.KeyboardView and decide on layout. See the onKey and onText methods at the end of that file for the action taken when keys are pressed.

代替我的键盘模型内部类,您可以从 XML 加载它 如果您的密钥集相当稳定.

Instead of my keyboard model inner class, you could load it from XML if your key set is fairly constant.

这篇关于安卓应用专用软键盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

Storing and reading files from Documents directory iOS 5(从 Documents 目录存储和读取文件 iOS 5)
How can i use MYSQL database connection in iphone application useing cocos2d?(如何在使用 cocos2d 的 iphone 应用程序中使用 MYSQL 数据库连接?)
Smoothly drag a Sprite in cocos2d - iPhone(在 cocos2d 中平滑拖动一个 Sprite - iPhone)
CCScrollView scroll and touch events never firing(CCScrollView 滚动和触摸事件永远不会触发)
removing jagged edges of my ropes using antialiasing of OpenGLES(使用 OpenGLES 的抗锯齿去除绳索的锯齿状边缘)
cocos2d Moving between scene(cocos2d 在场景之间移动)