I implemented TimePickerDialogusing the following code provided at developer.android.com :
public static class TimePickerFragment extends DialogFragment
implements TimePickerDialog.OnTimeSetListener {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
final Calendar c = Calendar.getInstance();
int hour = c.get(Calendar.HOUR_OF_DAY);
int minute = c.get(Calendar.MINUTE);
return new TimePickerDialog(getActivity(), this, hour, minute,
DateFormat.is24HourFormat(getActivity()));
}
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
}
}
I get a dialog like this:

I want to change the theme TimePickerDialogto go with AppTheme, which extends the theme AppCompat. When I use another constructor, as some have said, the theme works, but Dialoggoes into full-screen mode. The code I used for this was:
// Create a new instance of TimePickerDialog and return it
return new TimePickerDialog(getActivity(), R.style.AppTheme, this, hour, minute,
DateFormat.is24HourFormat(getActivity()));
I get this:

How can I do it? “I want to Dialogstay the same, but change only the colors of the accent.” Thanks!
source
share