I'm currently making a registration form, and one of the fields is for the users Date of Birth. I want to use datepicker, however I don't want the calendar layout as shown below:
I want the layout to look something like this so that way its easier to choose the year and month without having to scroll through everything:
However I do not know how to go about this, or what to put inside the styles.xml file. Any help would be greatly appreciated.
Above properties are of XML, if you want to set it programmatically you can you the below code but I haven't checked this code whether its working or not.
Add this to
style.xml
And then you should apply style for your date picker like this:
To set the DatePicker style globally, add the following to
style.xml
, or adjust existing content:And define your customized DatePicker style, either in
style.xml
or a separate file, e.g.:DatePickerDialog has a convenience method, where you set the desired layout.
Passing 1 or 2 in themesResId does the trick.
Create style with
Then in custom fragment dialog xml
Link : http://yogeshkalwar.blogspot.in/2017/08/custom-spinner-datepicker-supporting-n70.html