我有一个自定义的DialogFragment,里面有一个ArrayAdapter,里面有一些editTexts.显示对话框时,即使我按下编辑文本,也不会出现软键盘.编辑文本确实需要重点,但键盘永远不会出现.
如果我不使用适配器,只使用带有编辑文本的视图,它可以很好地工作,但只要我添加适配器,我就会遇到问题.
我的代码如下.任何帮助将非常感激.
提前致谢.
public class ParameterDialog extends DialogFragment {
Context context;
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
ArrayList<Parameter> params = this.getArguments().getParcelableArrayList(MainActivity.KEY_PARAMS_TO_DIALOG);
String name = this.getArguments().getString(MainActivity.KEY_NAME_TO_DIALOG);
context = getActivity();
// Use the Builder class for convenient dialog construction
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
ParameterDialogAdapter pda = new ParameterDialogAdapter(context,R.layout.parameter_config_string , params);
// Inflate and set the layout for the dialog
// Pass null as the parent view because its going in the dialog layout
builder
.setTitle(name)
.setAdapter(pda,null)
.setPositiveButton("Send", new DialogInterface.OnClickListener() { …Run Code Online (Sandbox Code Playgroud)