igodie
igodie

Reputation: 537

Materialdatepicker with a spinner style

Using the default DatePicker class from android it was possible to make the datepicker in form of spinner like this:

spinner

But with MaterialDesignSpinner it seems that this feature by default is not implemented, as the only form looks like this:

example

or default textview input.

Did materialdesign remove the spinner feature, or is there a way to implementing it using the MaterialDatePicker?

Upvotes: 3

Views: 1086

Answers (1)

user2267367
user2267367

Reputation: 872

I could't find a solution for the MaterialDatePicker, but I want to share my solution anyways, it works for my purpose it might for yours too:

    DatePickerDialog dpd = new DatePickerDialog(this,
            AlertDialog.THEME_HOLO_LIGHT,null, 1960, 1, 1);
    dpd.getDatePicker().setCalendarViewShown(false);
    dpd.show();

This will display the light version of the date picker dialog. You can also use:

AlertDialog.THEME_HOLO_DARK

For a dark dialog theme or:

android.R.style.Theme_Holo_Light_Dialog

For a slightly different dialog itself. Keep in mind to set dpd.getDatePicker().setCalendarViewShown(false); otherwise the regular calendar part of the picker is shown in addition. If you look for more variations see this answer.

Upvotes: 1

Related Questions