我已经创建了带有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);
}
帮助我解决问题,提前致谢。
答案 0 :(得分:2)
你可以试试这个。
Your_EditText_Obj.requestFocus();
Your_EditText_Obj.setFocusable(true);
您是否设置了android:windowSoftInputMode="stateVisible