I'm currently using this https://developer.android.com/reference/android/app/DatePickerDialog
What I would like to do is to be able to mark specific dates with a specific color. Say for example march 3 5 and 7 have a red circle around them. Is this possible?
There is also another easier way from customizing DatePickerDialog!
You can use this great library Material DateTime Picker to achieve your desired features.
[DatePickerDialog] setHighlightedDays(Calendar[] days):
You can pass a Calendar[] of days to highlight within setHighlightedDays(Calendar[] days) method. They will be rendered in bold. You can tweak the color of the highlighted days by overwriting mdtp_date_picker_text_highlighted
(from official doc)
Related
I want to change the colour of the WeekDay text for the current week. I am able to change the colour for the current day using a decorator. Is it possible to do this while using this library?
Link to the library: https://github.com/prolificinteractive/material-calendarview
if you using
'com.github.shuwnyuantee:Material-Calendar-View:1.3'
week layout in calender_view.xml
to manage your condition , you will have to change inside CalenderView.java file
because the ID of the week layout is being found here.
I have a DatePickerDialoge in my Fragment, I have set its min and max valid dates.
datePickerDialog.setMinDate(calenderMinObj);
datePickerDialog.setMaxDate(calendarMaxObj);
It is working fine and valid dates are in bold
But I want to change the colour of all valid dates to green so user can easily understand. How can i do that?
You will have to add/override style to your DateTime Fragment. Please follow the below-mentioned link to achieve the desired result:-
https://www.tutorialsbuzz.com/2019/09/android-datepicker-dialog-styling-kotlin.html
I am trying to implement the date picker dialog but the dialog appears with just a single date and show rest of the date as blank what could be the reason?
This is definitely a Theme issue. The selected date is visible because of the contrast in text color and circle color. You can refer this link for understanding the anatomy of the Date Picker theme by the Material design guideline.
https://material.io/components/date-pickers#theming
Refer this answer for understanding which colors to use.
https://stackoverflow.com/a/29014475/4491971
You can use these attributes to change the colors via style
dayOfWeekBackground
dayOfWeekTextAppearance
headerMonthTextAppearance
headerDayOfMonthTextAppearance
headerYearTextAppearance
headerSelectedTextColor
yearListItemTextAppearance
yearListSelectorColor
calendarTextColor
calendarSelectedTextColor
If you share the current style and the code snippet, we can refine the answer more.
The current JavaFX implementation of a DatePicker only allows you to select a year and month by clicking the < > buttons. Most modern implementations of DatePicker allow you to select the year for example like this:
How do we get this functionality?
So far I have not seen a datepicker with that feature in JavaFX. Neither the javafx.scene.control.DatePicker nor the ControlsFX- and JFXtras-controls have such a functionality as far as I know (ControlsFX even doesn't provide a datepicker to my knowledge).
However on http://calendarcontrolinjavafx.blogspot.com/2012/01/calendar-control-in-javafx-20.html there is a custom datepicker with such a functionality (but with a different style) together with a demo application.
Unfortunately the implementation is from 2012 and is in JavaFX 2. However, with minimal changes it runs with >= JavaFX 8. Below are a few snapshots. I have no idea concerning the stability but maybe it's worth a try.
I am not sure if you needed a year picker or a year-month picker but I assume the latter. I also needed one for year-months and could not find anything that works for javafx 8 or above so I wrote one: https://github.com/perNyfelt/fx-yearmonth-picker.
I am looking for a component for Swing that would do the same thing that Windows 7 date and time pickers do (or be even better). They look so:
And have following features I need:
you cannot enter an invalid value (value is ignored as you type and not when you leave the field)
it allows continuous updating of the field until the first change made by user (take a look on the time setting in Windows 7)
you can select and change at once only one position - not the whole text at once (so colons and points cannot be removed)
up and down buttons
calendar button (but it's rather optional for me)
I have tried JSpinner with a DateEditor but it doesn't have this features. JXDatePicker only adds the calendar button.
Generally I am looking for a nice way to let user enter date and time in a powerful and simple way. Windows 7 solution seems to be quite good.
Thank you!
best and free DatePickers around are JXDatePicker and JCalendar, in both cases are there focus about correct implementations of Date and Focus workaround, and excelent Renderer and Editor for JTree / JTreeTable / JTable
to your needs ---> all these funcionalities are implemented by default, not clear from your questions exactly whats wrong, I'm Win7 and JXDatePicker and JCalendar but I never saw these issues,
in both cases you have to implementing own workaround for SpecialDays as hollydays (and etc),