弹出窗口打开时,软键盘未打开

时间:2015-10-29 12:40:07

标签: android popup android-softkeyboard soft-keyboard

我已经创建了带有edittext的自定义弹出窗口,而我正在尝试在edittext中写一些软键盘没有出现,

我的代码,

public void popUpCreateList(final View v) {

    View popupView;

    final EditText et_list_name;
    Button b_add;

    LayoutInflater layoutInflater = (LayoutInflater) mContext
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    popupView = layoutInflater.inflate(R.layout.dialog_create_list, null);
    popup_create_list = new PopupWindow(popupView,
            WindowManager.LayoutParams.FILL_PARENT,
            WindowManager.LayoutParams.FILL_PARENT, false);

    et_list_name = (EditText) popupView
            .findViewById(R.id.dialog_friend_create_list_edt_list_name);
    b_add = (Button) popupView
            .findViewById(R.id.dialog_friend_create_list_btn_add_list);


    new Handler().postDelayed(new Runnable() {

        public void run() {
            popup_create_list.showAtLocation(v, Gravity.NO_GRAVITY, 0, 0);
            popup_create_list.update();
            popup_create_list.setFocusable(true);
        }

    }, 100L);



}

帮助我解决问题,提前致谢。

1 个答案:

答案 0 :(得分:2)

你可以试试这个。

  1. Your_EditText_Obj.requestFocus();

  2. Your_EditText_Obj.setFocusable(true);

  3. 您是否设置了android:windowSoftInputMode="stateVisible

  4.   

    Soft keyboard doesn't appear