android 如何在 Timepicker 对话框中更改分隔线颜色

How to change divider color in Timepicker dialog in android

如何在 android.As 中以编程方式更改时间选择器分隔对话框 我在主题下方使用了其显示的默认颜色 blue.I 需要将其更改为红色。

 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

将此项添加到您的主题

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

在此样式中设置自定义分隔线颜色

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