本文介绍了Android的输入法:呈现一个自定义的弹出式对话框(像了Swype键盘),它可以输入文本的TextView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道我怎么可以创建一个自定义弹出像在下面的截图(从了Swype键盘借来的),在那里我可以有几个按钮,其中每次提交一个字符串,当前连接的TextView (通过的)。

I'm wondering how I can create a custom pop-up like the one in the screenshot below (borrowed from the Swype keyboard), where I can have a couple of buttons, which each commit a string to the currently "connected" TextView (via a InputConnection).

请注意:这是一个 InputMethodService ,而不是一个普通的活动。我已经尝试启动一个单独的活动主题:对话。然而,只要一个打开我失去了我的重点与的TextView 和我的键盘消失(和我的 InputConnection 走了)。

Please note: this is an InputMethodService and not an ordinary Activity. I already tried launching a separate Activity with Theme:Dialog. However, as soon as that one opens I lose my focus with the TextView and my keyboard disappears (and with that my InputConnection is gone).

推荐答案

您可以尝试使用的 PopupWindow 。你所要做的黑客得到它做你想要什么,唯一的好文档,它是源的一点。

You can try using a PopupWindow. You'll have to do a bit of hacking to get it to do what you want and the only good documentation for it is the source.

这篇关于Android的输入法:呈现一个自定义的弹出式对话框(像了Swype键盘),它可以输入文本的TextView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 19:58