Soft Keyboard не отображается при использовании адаптера в DialogFragment
У меня есть собственный DialogFragment, в котором есть ArrayAdapter, в котором есть некоторые editTexts. Когда отображается диалоговое окно, программная клавиатура не появляется, даже если я нажимаю на текст редактирования. Редактируемый текст фокусируется, но клавиатура никогда не появляется.
Если я не использую адаптер и просто использую вид с текстом редактирования, он работает отлично, но как только я добавляю адаптер, я получаю проблему.
Мой код ниже. Любая помощь могла бы быть полезна.
Заранее спасибо.-
public class ParameterDialog extends DialogFragment {
Context context;
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
ArrayList 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() {
public void onClick(DialogInterface dialog, int id) {
}
})
.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
}
});
// Create the AlertDialog object and return it
return builder.create();
}}
public class ParameterDialogAdapter extends ArrayAdapter {
Context context;
int layoutResourceId;
ArrayList data= null;
public ParameterDialogAdapter(Context context, int layoutResourceId, ArrayList data) {
super(context, layoutResourceId, data);
this.layoutResourceId = layoutResourceId;
this.context = context;
this.data = data;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View row = convertView;
//ParameterHolder holder = null;
final LayoutInflater inflater = ((Activity)context).getLayoutInflater();
final int p =position;
row = inflater.inflate(layoutResourceId, parent, false);
return row;
}}
-layout
-Код для отображения диалога
ParameterDialog pDialog = new ParameterDialog ();
Bundle bundle = new Bundle();
bundle.putString(KEY_NAME_TO_DIALOG,action.getName());
bundle.putParcelableArrayList(KEY_PARAMS_TO_DIALOG, params);
pDialog.setArguments(bundle);
pDialog.setArguments(bundle);
pDialog.show(ft, "parameter_dialog");