0

How to change timepicker divider dialog programmatically in android.As I used below theme the default color its showing blue.I need to change it to red.

 TimePickerDialog timePickerDialog = new TimePickerDialog(context, android.R.style.Theme_Holo_Light_Dialog_NoActionBar, myTimeListener, hour, minute, false);
    timePickerDialog.setTitle("Schedule Reminders");
    timePickerDialog.setButton(DialogInterface.BUTTON_POSITIVE, "Set", timePickerDialog);
    timePickerDialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
    timePickerDialog.show();

enter image description here

  • You must change the theme in the constructor parameter. Use custom theme you have created instead of android.R.style.Theme_Holo_Light_Dialog_NoActionBar. See also: https://stackoverflow.com/a/51037169 – Taha Körkem Jul 26 '21 at 11:25

1 Answers1

0

add this item to your main theme

 <item name="numberPickerStyle">@style/MyApp.NumberPicker</item>

set custom divider color in this style

 <style name="MyApp.NumberPicker" parent="Widget.Holo.NumberPicker">
   <item name="selectionDivider">@color/white</item>
 </style>