I created a TimePickerDialog and changed the default color. In addition, I would like to change the style to a different style.
I couldn't find a way to change the color and also the style at the same time.
This is how I created my TimePickerDialog:
TimePickerDialog Code:
public void showHourPicker() {
final Calendar myCalender = Calendar.getInstance();
int hour = myCalender.get(Calendar.HOUR_OF_DAY);
int minute = myCalender.get(Calendar.MINUTE);
TimePickerDialog.OnTimeSetListener myTimeListener = new TimePickerDialog.OnTimeSetListener() {
@Override
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
if (view.isShown()) {
myCalender.set(Calendar.HOUR_OF_DAY, hourOfDay);
myCalender.set(Calendar.MINUTE, minute);
updateHourEditText(myCalender);
}
}
};
TimePickerDialog timePickerDialog = new TimePickerDialog(getContext(),R.style.TimePickerDialogStyle , myTimeListener, hour, minute, true);
timePickerDialog.setTitle("Choose hour:");
timePickerDialog.show();
}
And this it the style:
<style name="TimePickerDialogStyle" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="colorControlActivated">@color/mcgpalette_300</item>
<item name="colorAccent">@color/mcgpalette_300</item>
</style>
And the TimePickerDialog that I get looks like:
If I try to change the style, as you can see in the picture below, I get the style I want but not in the color as in the above example. Code for good style, but without my color:
TimePickerDialog timePickerDialog = new TimePickerDialog(getContext(), 2 , myTimeListener, hour, minute, true);
My Question is: How can I set the style to be as in the second picture and the color as in the first picture?