Reputation: 179
I can't show the another date in android 5 lollipop.
DatePickerDialog.OnDateSetListener onDateSetListener = new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker datePicker, int year, int month, int dayOfMonth) {
}
};
DatePickerDialog datePickerDialog = new DatePickerDialog(activity, R.style.DatePickerDialogStyle, onDateSetListener, 2019, 9, 19);
datePickerDialog.show();
I am use below datepicker style
<style name="DatePickerDialogStyle">
<item name="showTitle">false</item>
<item name="colorControlActivated">@color/colorAccent</item>
<item name="android:headerBackground">@color/colorAccent</item>
</style>
Upvotes: 0
Views: 369
Reputation: 692
Just check it
In my code, I have added custom style which name is "DatePickerDialogStyle"
In style.xml file add this style:-
<style name="DatePickerDialogStyle">
<item name="showTitle">false</item>
<item name="colorControlActivated">@color/colorAccent</item>
<item name="android:headerBackground">@color/colorAccent</item>
<item name="android:windowIsFloating">true</item>
<item name="android:textColorSecondary">@color/black</item>
</style>
Example :-
DatePickerDialog datePickerDialog = new DatePickerDialog(activityName.this, R.style.DatePickerDialogStyle, new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) {
}
}, year, month, day);
datePickerDialog.show();
I hope It will work.
Upvotes: 1
Reputation: 3841
You need have to just remove theme in Object of DatePickerDialog
your object of DatePickerDialog
initialisation will be like this
DatePickerDialog(getViewActivity(), onDateSetListener, Calendar.getInstance().get(Calendar.YEAR), Calendar.getInstance().get(Calendar.MONTH), Calendar.getInstance().get(Calendar.DAY_OF_MONTH))
Let me know if it working or not i haven't check this in Lollipop device
Upvotes: 0