How to set TimePicker show with format 24h

前端 未结 11 1005
独厮守ぢ
独厮守ぢ 2020-12-29 18:17

I\'ve created a TimePicker in layout and I want it to show time with format 24h.

Can you help me? Thanks.

11条回答
  •  灰色年华
    2020-12-29 18:35

    You just have to retrieve the TimePicker instance from the view after inflating it, then you can modify the widget.

    Ids are arbitrary:

    View v=getActivity().getLayoutInflater().inflate(R.layout.dialog_time, null);
    TimePicker timePicker=(TimePicker)v.findViewById(R.id.dialog_time_timePicker);
    timePicker.setIs24HourView(true);
    

提交回复
热议问题