For DatePicker I use this code:
public static void setDatePickerTextColor(DatePicker dp, int color) {
LinearLayout l = (LinearLayout) dp.getChildAt(0);
if (l != null) {
l = (LinearLayout) l.getChildAt(0);
if (l != null) {
for (int i = 0; i < 3; i++) {
NumberPicker np = (NumberPicker) l.getChildAt(i);
if (np != null) {
setNumberPickerTextColor(np, color);
}
}
}
}
}
public static boolean setNumberPickerTextColor(NumberPicker numberPicker, int color) {
final int count = numberPicker.getChildCount();
for (int i = 0; i < count; i++) {
View child = numberPicker.getChildAt(i);
if (child instanceof EditText) {
try {
Field selectorWheelPaintField = numberPicker.getClass()
.getDeclaredField("mSelectorWheelPaint");
selectorWheelPaintField.setAccessible(true);
((Paint) selectorWheelPaintField.get(numberPicker)).setColor(color);
((EditText) child).setTextColor(color);
numberPicker.invalidate();
return true;
} catch (NoSuchFieldException e) {
Log.w("NumberPickerTextColor", e);
} catch (IllegalAccessException e) {
Log.w("NumberPickerTextColor", e);
} catch (IllegalArgumentException e) {
Log.w("NumberPickerTextColor", e);
}
}
}
return false;
}
Although, it was tested only on Lollipop.