Android IME: showing a custom pop-up dialog (like Swype keyboard) which can enter text into the TextView

后端 未结 4 2160
刺人心
刺人心 2021-01-03 04:21

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 com

4条回答
  •  粉色の甜心
    2021-01-03 04:43

    I was banging my head against this problem too and I finally figured it out. The above solutions are correct although as you pointed out they cannot be used from an InputMethodService because it is not an Activity. The trick is to create the PopupWindow in a subclass of KeyboardView. By using a negative Y position, the PopupWindow can appear above the keyboard like Swype.

    Good luck, Barry

提交回复
热议问题