Soft keyboard's POPUP layout

送分小仙女□ 提交于 2019-12-03 23:20:44

Well, it is not exactly what I was looking for, but this resolves the problem.

I made my own keyboard view and made a popup window to show when a key is long pressed.

public class MyKeyboardView extends KeyboardView{
   @Override
   protected boolean onLongPress(final Key popupKey) {
        final View custom = LayoutInflater.from(context)
        .inflate(R.layout.popup_layout, new FrameLayout(context));
        popup = new PopupWindow(context);
        popup.setWidth(WindowManager.LayoutParams.WRAP_CONTENT);
        popup.setHeight(WindowManager.LayoutParams.WRAP_CONTENT);
        popup.showAtLocation(this, Gravity.NO_GRAVITY, popupKey.x, popupKey.y-50);
        return true;
   }
}

This way you can customize the popup any way you want in the xml.

But this is not the correct answer, if you know a better way to do this please answer this question.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!