I cant seem to convert datepickerdialog into a spinner through xml. I am not currently using API 24 that has a bug. I try to do it by defining a new style and use it when instatiating DatePickerDialog like it is recommended here but it still does not work;
<style name="CustomDatePickerDialog" parent="android:Theme.Material.Light.Dialog">
<item name="android:datePickerStyle">@style/MyDatePickerStyle</item>
</style>
<style name="MyDatePickerStyle" parent="@android:style/Widget.Material.Light.DatePicker">
<item name="android:datePickerMode">spinner</item>
<item name="android:calendarViewShown">false</item>
<item name="android:spinnersShown">true</item>
</style>
here is the dialog definition;
dialog = new DatePickerDialog(CurrentActivity.this, R.style.CustomDatePickerDialog, new DatepickerDialog.OnDateSetListener() {...}, y,m,d);
dialog.show();
The weird thing is that if i define in code after the dialog instatiation and before showing it, these two lines, it will present me the spinner only, which is what i want;
dialog.getDatePicker().setCalendarViewShown(false);
dialog.getDatePicker().setSpinnersShown(true);
i cant figure out why xml wont work on me, even though other people seem to be good with it. am i using wrong context? Any help is welcome.
EDIT: I'm having issue cause i don't want to use the deprecated two lines that solve my problem. So that means i don't want to use Theme_Holo_Light or other similar deprecated themes either.