5

I'm creating a datepickerdialog like this:

Calendar newCalendar = Calendar.getInstance();

myDatePicker = new DatePickerDialog(this, new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
// do something
}
}
, newCalendar.get(Calendar.YEAR), newCalendar.get(Calendar.MONTH), newCalendar.get(Calendar.DAY_OF_MONTH));

myDatePicker.show();

Unfortunately what I'm getting back is something that looks like this:

what I'm getting

And what I actually want to get is something that looks like this:

what I want to get

I'm talking about the header. I want the day, and under that the month, day of the month, year.. This seems to be fairly standard and default because I've seen loads of example screenshots that look like that floating around, but obviously I'm doing something wrong because it doesn't look like that for me.

Edit: a potential workaround for this is to use the third party library:

https://github.com/wdullaer/MaterialDateTimePicker

but this isn't ideal. I'm still hoping for a solution that doesn't require third party libraries.

Jon
  • 7,941
  • 9
  • 53
  • 105

0 Answers0