Is it possible to change the style of an Android L TimePickerDialog?

后端 未结 4 1399
陌清茗
陌清茗 2020-12-03 05:10

I was testing my app on an Android L emulator, and I noticed that the TimePickerDialog has significantly changed to this:

4条回答
  •  广开言路
    2020-12-03 05:41

    If you want the AM / PM to be a picker instead of a button then I recommend you use the single parameter constructor with a ContextThemeWrapper:

    new TimePicker(new ContextThemeWrapper(getActivity(), android.R.style.Theme_Holo_Light_Dialog_NoActionBar));
    

    AM-PM picker

    If you pass the theme into the multiple parameter constructor then you'll end up with a rather ugly AM / PM button, and the colon will be missing between the hour and minute columns.

    new TimePicker(getActivity(), null, TimePickerDialog.THEME_HOLO_LIGHT);
    

    AM-PM button

提交回复
热议问题