将系统软键盘更换为定制软键盘
我在 Android 项目上创建了自己的键盘,并且运行良好;这是一小段代码:
mKeyboard = new Keyboard(this, R.layout .keyboard);
mKeyboardView = (CustomKeyboardView) findViewById(R.id.KeyboardArea);
mKeyboardView.setKeyboard(mKeyboard);
每当用户触摸我的 Activity 的 editText 时,我都会让它出现。我的问题是,如果我按下模拟器键盘的中央按钮,标准键盘仍然可以工作...此外,尽管我将其放在
android:windowSoftInputMode="adjustResize"
我的 AndroidManifest 文件中,但它仅适用于标准键盘...所以,是否可以用我定制的软键盘完全替代系统的软键盘?
I created my own keyboard on my Android Project, and it works fine; here is a little snippet of code:
mKeyboard = new Keyboard(this, R.layout .keyboard);
mKeyboardView = (CustomKeyboardView) findViewById(R.id.KeyboardArea);
mKeyboardView.setKeyboard(mKeyboard);
I make it appear whenever the user touches the editText of my Activity. My problem is that the standard keyboard is still working if I press the central botton of my emulator keyboard...furthermore despite I put this:
android:windowSoftInputMode="adjustResize"
in my AndroidManifest file but it only works for the standard keyboard...so, is it possibile to completely substitute the system's soft keyboard with my customized one?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试: getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
另请参阅:如何停止焦点更改时自动显示软键盘(OnStart 事件)
Try: getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
See also: How to stop Soft keyboard showing automatically when focus is changed (OnStart event)
你只需这样做....
你也可以参考 API 演示中的 android 软键盘示例
You just do this....
You can also refer the android softkeyboard example in the API Demos