I have a custom DialogFragment which has an ArrayAdapter in it which has some editTexts in it. When the dialog is shown the soft keyboard does not appear even if i press on
I have come across a similar problem while using a FragmentDialog
containing a ListView
. The items in the ListView
contained EditText
widgets that did not bring up the soft keyboard.
A workaround I discovered was to place an invisible EditText
within the root layout of the FragmentDialog
.
For example:
list_layout.xml:
DialogFragment creates the views as follows:
@Override
public Dialog onCreateDialog(Bundle savedInstanceState)
{
LayoutInflater inflater = getActivity().getLayoutInflater();
View listLayout = inflater.inflate(R.layout.list_layout, null);
mListView = (ListView) listLayout.findViewById(android.R.id.list);
return new AlertDialog.Builder(getActivity()).setView(listLayout).create();
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState)
{
super.onActivityCreated(savedInstanceState);
//set adapter
mListView.setAdapter(mListAdapter);
}
Hope this helps