问题描述
我不知道我怎么可以创建一个自定义弹出像在下面的截图(从了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).
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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!