I have implemented a TimePickerDialog
using the following code as given in developer.android.com:
public static class TimePickerFragment extends DialogFragment
implements TimePickerDialog.OnTimeSetListener {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
// Use the current time as the default values for the picker
final Calendar c = Calendar.getInstance();
int hour = c.get(Calendar.HOUR_OF_DAY);
int minute = c.get(Calendar.MINUTE);
// Create a new instance of TimePickerDialog and return it
return new TimePickerDialog(getActivity(), this, hour, minute,
DateFormat.is24HourFormat(getActivity()));
}
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
// Do something with the time chosen by the user
}
}
I get a dialog like this one:
I want to change the theme of the TimePickerDialog
to go with the AppTheme
which extends an AppCompat
theme. When i do use the other constructor as told by some, the theme works, but the Dialog
goes fullscreen. The code i used for that 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 do i go about this? - I want the Dialog
to remain the same, but change only the accent colors. Thanks!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…