You can try this solution. works for me.
public class MainActivity extends AppCompatActivity implements DatePickerDialog.OnDateSetListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
int month = calendar.get(Calendar.MONTH);
int day = calendar.get(Calendar.DAY_OF_MONTH);
DatePickerDialog datepickerdialog = new DatePickerDialog(this,
AlertDialog.THEME_HOLO_DARK,this,year,month,day);
colorizeDatePicker(datepickerdialog.getDatePicker());
datepickerdialog.show();
}
public static void colorizeDatePicker(DatePicker datePicker) {
Resources system = Resources.getSystem();
int dayId = system.getIdentifier("day", "id", "android");
int monthId = system.getIdentifier("month", "id", "android");
int yearId = system.getIdentifier("year", "id", "android");
NumberPicker dayPicker = (NumberPicker) datePicker.findViewById(dayId);
NumberPicker monthPicker = (NumberPicker) datePicker.findViewById(monthId);
NumberPicker yearPicker = (NumberPicker) datePicker.findViewById(yearId);
setDividerColor(dayPicker);
setDividerColor(monthPicker);
setDividerColor(yearPicker);
}
private static void setDividerColor(NumberPicker picker) {
if (picker == null)
return;
final int count = picker.getChildCount();
for (int i = 0; i < count; i++) {
try {
Field dividerField = picker.getClass().getDeclaredField("mSelectionDivider");
dividerField.setAccessible(true);
ColorDrawable colorDrawable = new ColorDrawable(picker.getResources().getColor(R.color.colorAccent));
dividerField.set(picker, colorDrawable);
picker.invalidate();
} catch (Exception e) {
Log.w("setDividerColor", e);
}
}
}
@Override
public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) {
}
}