昨天在做项目的时候发现一个问题,就是在自定义的AlertDialog里面点击EditText的时候软键盘不能弹出,目前已经解决,要先setView(),大家看代码就明白了;
final AlertDialog dialog = new AlertDialog.Builder(this).create();
LayoutInflater inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
RelativeLayout layout = (RelativeLayout)inflater.inflate(R.layout.activity_test_arcgis, null);
dialog.setView(layout);
dialog.show();
Window window = dialog.getWindow();
window.setContentView(R.layout.activity_test_arcgis);
EditText edit_des = (EditText)dialog
.findViewById(R.id.item_arcgis_edit_des);
LayoutInflater inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
RelativeLayout layout = (RelativeLayout)inflater.inflate(R.layout.activity_test_arcgis, null);
dialog.setView(layout);
dialog.show();
Window window = dialog.getWindow();
window.setContentView(R.layout.activity_test_arcgis);
EditText edit_des = (EditText)dialog
.findViewById(R.id.item_arcgis_edit_des);