I'm creating a simple DialogFragment with a custom adapter but strangely the text appears white when the dialog shows up.
class MyDialog extends DialogFragment {
ListView listView;
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
ArrayAdapter<Service> adapter = new MyAdaper(getContext(), items);
TextView title = new TextView(getContext());
title.setText("Hello");
title.setGravity(Gravity.CENTER);
title.setTextSize(18);
title.setTextColor(Color.BLACK);
builder.setCustomTitle(title);
builder.setAdapter(adapter, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
return builder.create();
}
The layout xml inflated in the adapter is very simple and only has one TextView (I didn't specify any color but I would expect it to be black as the rest of my application when I use a TextView without specifying colors)
I have tried using
AlertDialog.Builder(getActivity(), R.style.MyTheme);
But even if I specify b black textColor in MyThem the Dialog still shows up with white text
What Am I missing ?