public static void setNumberPickerTextColor(Context context,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);
numberPicker.invalidate();
((EditText)child).setTextColor(color);
}catch(Exception e){
e.printStackTrace();
}
}
}
}
The above code changing color of all options . But I want to change only selected option color
Thanks in Advance!!!!