Android浮动键盘 [英] Android floating keyboard

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

问题描述

是否可以通过编程方式更改键盘的位置?我正在开发一个用于图腾的应用程序,如果键盘停靠在底部,则很难使用.

我试图创建一个扩展InputMethodService的自定义键盘,并且我能够更改键的布局,但无法更改键盘的视图位置.

Is it possible to change programmatically the position of the keyboard? I'm developing an app for a totem, and if the keyboard appears docked on the bottom, it's very difficult to use.

I tried to create a custom keyboard extending the InputMethodService, and i'm able to change the layout of the keys, but i'm not able to change the keyboard's view position.

SwiftKey allows to undock the keyboard and to drag it vertically, how can they do that?

解决方案

Inside InputMethodService, you have reference to a Window. Add your dragging logic to update LayoutParams for the window. Make sure you implement onComputeInset properly. On a note that the gravity of window is always CENTER horizontally and BOTTOM vertically even though you try to use a new LayoutParams for the window.

Check out my sample https://github.com/dbof10/float-keyboard

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

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