private void showDialog() {
LayoutInflater inflater = LayoutInflater.from(getActivity());
View dlgView = inflater.inflate(R.layout.special_code_input_dlg, null);
final EditText et = (EditText) dlgView.findViewById(R.id.special_code_input);
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle(R.string.set_special_code_title)
.setMessage(R.string.set_special_code_message)
.setView(dlgView) // 设置view
.setPositiveButton(R.string.dlg_submit, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
String code = et.getText().toString();
Toast.makeText(getActivity(), "获取输入的code=" + code, Toast.LENGTH_LONG).show();
}
}).setCancelable(true);
AlertDialog dlg = builder.create();
dlg.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT); // 弹出系统级别的dlg 需要系统权限
dlg.show();
}