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
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 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.
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)
I am using a Calendar View in Android I want to change the color of specific dates in calendar. For instance, I might want to set the color of all holidays to green, or the color of days with meetings to red. How can I do this in Android?
Try using CalenderView to create your own CustomCalendarView and change any desired colors in appearance.
You can find the code for the native CalendarView here.
Use this one:
import android.widget.CalendarView.OnDateChangeListener;
I am using a Calender View in android.I am trying to change the background color of the particular date which i want. I have gone through the Calender View Document Here
But not able find a method like SetDateBackgroundColor(Date date,Color color);
Please tell me how to achieve it?
I don't think there is a method for that but you can set an OnDateChangeListener which checks for the current date selected and changes the background if the date matches your date.