問題描述
我想知道如何創建一個自定義彈出窗口,如下面屏幕截圖中的那個(借自 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).
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 IME:顯示一個自定義彈出對話框(如 Swype 鍵盤),可以在 TextView 中輸入文本的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!