Android应用程序特定的软键盘 [英] android app specific soft keyboard

查看:227
本文介绍了Android应用程序特定的软键盘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法来创建一个应用程序特定的软键盘在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.

推荐答案

如果你只是想要一个视图,看起来就像一个软键盘,我这样做,在<一个href="https://github.com/chrisboyle/sgtpuzzles/blob/master/app/src/main/java/name/boyle/chris/sgtpuzzles/SmallKeyboard.java"相对=nofollow>我SmallKeyboard类。你只需要延长 android.inputmethodservice.KeyboardView 并决定布局。看到onKey和onText方法在该文件中,当密钥是pressed所采取的行动的末端。

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.

这篇关于Android应用程序特定的软键盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆