簡體   English   中英

如何使用alertDialog.Builder顯示自定義鍵盤?

[英]How to show custom keyboard with alertDialog.Builder?

我需要顯示帶有alertText和editText的自定義鍵盤;

我正在使用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);

這段代碼打開了我的自定義鍵盤,但是在對話框窗口下。...(

任何想法如何解決這個問題?

使用PopupWindow。

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

對話框對於自定義軟鍵盤不是一個很好的選擇。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM