How to change datepicker background color in android

I need to change the background white color of calendarDatePicker in android. I have tried so many references in SO. but nothing worked for me. So please share with me if you have any ideas. I know this is a duplicate question. but my requirement is completely different. that is why i ask the question here. need to change the light gray color to what color I want

this is my calendar activity

    public void calenderPicker() {
    Calendar date = Calendar.getInstance();
    CalendarDatePickerDialog calendarDatePickerDialog = CalendarDatePickerDialog.newInstance(Personal.this, date.get(Calendar.YEAR), date.get(Calendar.MONTH),
                               date.get(Calendar.DAY_OF_MONTH));
    calendarDatePickerDialog.show(getFragmentManager(), FRAG_TAG_DATE_PICKER);
    }

this is my onDateset ()

@Override
    public void onDateSet(CalendarDatePickerDialog calendarDatePickerDialog, int year, int monthOfYear, int dayOfMonth) {
}

enter image description here

+4
source share
1 answer

Raghunandhan clearly pointed out in the comments where you need to precisely change the background color.

As he told you to watch this github post.Moreover you can implement this in your project.

datetimepicker-library/res/layout/date_picker_selected_date.xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@id/day_picker_selected_date_layout"
    android:layout_width="@dimen/date_picker_component_width"
    android:layout_height="0.0dip"
    android:layout_weight="1.0"
    android:background="#C689F5"   //change the background color for your requirement
    android:gravity="center"
    android:orientation="vertical">

.........
.........
</LinearLayout>

:

enter image description here

+2

All Articles