Android: datepickerdialog header is not like it.

I create a datepickerdialog as follows:

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, I will return to what looks like this:

what i get

And what I really want to get is what looks like this:

what i want to get

I'm talking about the headline. I want a day, and under it a month, day of the month, year. This seems pretty standard and default, because I saw a lot of examples of screenshots that look like floating around, but obviously I'm doing something wrong, because it doesn’t look like to me.

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

https://github.com/wdullaer/MaterialDateTimePicker

but it is not perfect. I still hope for a solution that does not require third-party libraries.

+4

Source: https://habr.com/ru/post/1624761/


All Articles