【问题标题】:How to show custom keyboard with alertDialog.Builder?如何使用 alertDialog.Builder 显示自定义键盘?
【发布时间】:2016-04-17 11:32:59
【问题描述】:

我需要用带有editText的alertDialog显示自定义键盘;

我正在使用 AlertDialog.Builder 来创建新的 alertDialog。

一段时间后我可以禁用默认键盘,但我仍然无法显示我自己的自定义键盘...

这是我的代码的一部分:

AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);

        builder.setView(view);
        builder.setTitle(mActivity.getString(R.string.title));
        builder.setMessage(mActivity.getString(R.string.message));
builder.setNegativeButton(mActivity.getString(R.string.negative),
                new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {

                    }
                });
        builder.setPositiveButton(R.string.positive,
                new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {

                    }
                });
        mDialog = builder.create();
mDialog.show();

mDialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
Keyboard_Digits kd = new Keyboard_Digits
                .Builder(mActivity, keboardView)
                .build();
        kd.showCustomKeyboard(mEditText);

此代码打开我的自定义键盘,但在对话框窗口下......(

知道如何解决这个问题吗?

【问题讨论】:

    标签: android android-alertdialog android-softkeyboard custom-keyboard


    【解决方案1】:

    使用弹出窗口。

    PopupWindow popup;
    final View custom = LayoutInflater.from(context)
    .inflate(R.layout.popup_layout, new FrameLayout(context));
    popup = new PopupWindow(context);
    

    对话框不是自定义软键盘的好选择。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-03-15
      • 2016-09-14
      • 2014-11-25
      • 1970-01-01
      • 2010-11-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多