Stay organized with collections
Save and categorize content based on your preferences.
DayViewDecorator
public
abstract
class
DayViewDecorator
extends Object
implements
Parcelable
java.lang.Object
|
↳ |
com.google.android.material.datepicker.DayViewDecorator
|
A decorator which allows customizing the day of month views within a MaterialDatePicker
.
Summary
Inherited constants |
From interface
android.os.Parcelable
int |
CONTENTS_FILE_DESCRIPTOR
|
int |
PARCELABLE_WRITE_RETURN_VALUE
|
|
Public methods |
ColorStateList
|
getBackgroundColor(Context context, int year, int month, int day, boolean valid, boolean selected)
Override this method to return a custom color to be applied to the background drawable of the
day view corresponding to the provided date.
|
Drawable
|
getCompoundDrawableBottom(Context context, int year, int month, int day, boolean valid, boolean selected)
Override this method to return a bottom compound drawable for the day view corresponding to the
provided date.
|
Drawable
|
getCompoundDrawableLeft(Context context, int year, int month, int day, boolean valid, boolean selected)
Override this method to return a left compound drawable for the day view corresponding to the
provided date.
|
Drawable
|
getCompoundDrawableRight(Context context, int year, int month, int day, boolean valid, boolean selected)
Override this method to return a right compound drawable for the day view corresponding to the
provided date.
|
Drawable
|
getCompoundDrawableTop(Context context, int year, int month, int day, boolean valid, boolean selected)
Override this method to return a top compound drawable for the day view corresponding to the
provided date.
|
CharSequence
|
getContentDescription(Context context, int year, int month, int day, boolean valid, boolean selected, CharSequence originalContentDescription)
Override this method to return the day view's content description.
|
ColorStateList
|
getTextColor(Context context, int year, int month, int day, boolean valid, boolean selected)
Override this method to return a custom color to be applied to the text of the day view
corresponding to the provided date.
|
void
|
initialize(Context context)
Optionally override this method to do any initializing for your DayViewDecorator
instance.
|
Inherited methods |
From class
java.lang.Object
Object
|
clone()
|
boolean
|
equals(Object arg0)
|
void
|
finalize()
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
final
void
|
wait()
|
|
From interface
android.os.Parcelable
abstract
int
|
describeContents()
|
abstract
void
|
writeToParcel(Parcel arg0, int arg1)
|
|
Public constructors
DayViewDecorator
public DayViewDecorator ()
Public methods
getBackgroundColor
public ColorStateList getBackgroundColor (Context context,
int year,
int month,
int day,
boolean valid,
boolean selected)
Override this method to return a custom color to be applied to the background drawable of the
day view corresponding to the provided date.
Parameters |
context |
Context : The context of the day view |
year |
int : The year number corresponding to the day view (see ERROR(/java.util.Calendar.YEAR) ) |
month |
int : The month number (0-11) corresponding to the day view (see ERROR(/java.util.Calendar.MONTH) ) |
day |
int : The day of month number corresponding to the day view (see ERROR(/java.util.Calendar.DAY_OF_MONTH) ) |
valid |
boolean : Boolean for whether the day view is in a valid state (if not valid, the day view
will likely look and behave disabled) |
selected |
boolean : Boolean for whether the day view is in a selected state (if selected, the day
view will likely have a filled color background) |
getCompoundDrawableBottom
public Drawable getCompoundDrawableBottom (Context context,
int year,
int month,
int day,
boolean valid,
boolean selected)
Override this method to return a bottom compound drawable for the day view corresponding to the
provided date.
Parameters |
context |
Context : The context of the day view |
year |
int : The year number corresponding to the day view (see ERROR(/java.util.Calendar.YEAR) ) |
month |
int : The month number (0-11) corresponding to the day view (see ERROR(/java.util.Calendar.MONTH) ) |
day |
int : The day of month number corresponding to the day view (see ERROR(/java.util.Calendar.DAY_OF_MONTH) ) |
valid |
boolean : Boolean for whether the day view is in a valid state (if not valid, the day view
will likely look and behave disabled) |
selected |
boolean : Boolean for whether the day view is in a selected state (if selected, the day
view will likely have a filled color background) |
Returns |
Drawable |
The bottom compound drawable or null
|
getCompoundDrawableLeft
public Drawable getCompoundDrawableLeft (Context context,
int year,
int month,
int day,
boolean valid,
boolean selected)
Override this method to return a left compound drawable for the day view corresponding to the
provided date.
Parameters |
context |
Context : The context of the day view |
year |
int : The year number corresponding to the day view (see ERROR(/java.util.Calendar.YEAR) ) |
month |
int : The month number (0-11) corresponding to the day view (see ERROR(/java.util.Calendar.MONTH) ) |
day |
int : The day of month number corresponding to the day view (see ERROR(/java.util.Calendar.DAY_OF_MONTH) ) |
valid |
boolean : Boolean for whether the day view is in a valid state (if not valid, the day view
will likely look and behave disabled) |
selected |
boolean : Boolean for whether the day view is in a selected state (if selected, the day
view will likely have a filled color background) |
Returns |
Drawable |
The left compound drawable or null
|
getCompoundDrawableRight
public Drawable getCompoundDrawableRight (Context context,
int year,
int month,
int day,
boolean valid,
boolean selected)
Override this method to return a right compound drawable for the day view corresponding to the
provided date.
Parameters |
context |
Context : The context of the day view |
year |
int : The year number corresponding to the day view (see ERROR(/java.util.Calendar.YEAR) ) |
month |
int : The month number (0-11) corresponding to the day view (see ERROR(/java.util.Calendar.MONTH) ) |
day |
int : The day of month number corresponding to the day view (see ERROR(/java.util.Calendar.DAY_OF_MONTH) ) |
valid |
boolean : Boolean for whether the day view is in a valid state (if not valid, the day view
will likely look and behave disabled) |
selected |
boolean : Boolean for whether the day view is in a selected state (if selected, the day
view will likely have a filled color background) |
Returns |
Drawable |
The right compound drawable or null
|
getCompoundDrawableTop
public Drawable getCompoundDrawableTop (Context context,
int year,
int month,
int day,
boolean valid,
boolean selected)
Override this method to return a top compound drawable for the day view corresponding to the
provided date.
Parameters |
context |
Context : The context of the day view |
year |
int : The year number corresponding to the day view (see ERROR(/java.util.Calendar.YEAR) ) |
month |
int : The month number (0-11) corresponding to the day view (see ERROR(/java.util.Calendar.MONTH) ) |
day |
int : The day of month number corresponding to the day view (see ERROR(/java.util.Calendar.DAY_OF_MONTH) ) |
valid |
boolean : Boolean for whether the day view is in a valid state (if not valid, the day view
will likely look and behave disabled) |
selected |
boolean : Boolean for whether the day view is in a selected state (if selected, the day
view will likely have a filled color background) |
Returns |
Drawable |
The top compound drawable or null
|
getContentDescription
public CharSequence getContentDescription (Context context,
int year,
int month,
int day,
boolean valid,
boolean selected,
CharSequence originalContentDescription)
Override this method to return the day view's content description.
Parameters |
context |
Context : The context of the day view |
year |
int : The year number corresponding to the day view (see ERROR(/java.util.Calendar.YEAR) ) |
month |
int : The month number (0-11) corresponding to the day view (see ERROR(/java.util.Calendar.MONTH) ) |
day |
int : The day of month number corresponding to the day view (see ERROR(/java.util.Calendar.DAY_OF_MONTH) ) |
valid |
boolean : Boolean for whether the day view is in a valid state (if not valid, the day view
will likely look and behave disabled) |
selected |
boolean : Boolean for whether the day view is in a selected state (if selected, the day
view will likely have a filled color background) |
originalContentDescription |
CharSequence : The original day view's content description |
Returns |
CharSequence |
The content description
|
getTextColor
public ColorStateList getTextColor (Context context,
int year,
int month,
int day,
boolean valid,
boolean selected)
Override this method to return a custom color to be applied to the text of the day view
corresponding to the provided date.
Parameters |
context |
Context : The context of the day view |
year |
int : The year number corresponding to the day view (see ERROR(/java.util.Calendar.YEAR) ) |
month |
int : The month number (0-11) corresponding to the day view (see ERROR(/java.util.Calendar.MONTH) ) |
day |
int : The day of month number corresponding to the day view (see ERROR(/java.util.Calendar.DAY_OF_MONTH) ) |
valid |
boolean : Boolean for whether the day view is in a valid state (if not valid, the day view
will likely look and behave disabled) |
selected |
boolean : Boolean for whether the day view is in a selected state (if selected, the day
view will likely have a filled color background) |
initialize
public void initialize (Context context)
Optionally override this method to do any initializing for your DayViewDecorator
instance.
This method will be called whenever the date picker view is created, which can be important
if, e.g., your decorator's compound drawables are dependent on configurations such as screen
orientation.
Parameters |
context |
Context |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2023-10-09 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
{"lastModified": "Last updated 2023-10-09 UTC."}
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-10-09 UTC."]]