How do I set AM/PM in a TimePicker?

后端 未结 5 1772
有刺的猬
有刺的猬 2020-12-18 18:40

I am using a TimePicker in my app. Whenever the user opens the screen with the TimePicker, I initialize it with the current time. When I do this, the TimePicker shows AM ins

5条回答
  •  失恋的感觉
    2020-12-18 19:09

    You'll have to use Calendar.HOUR_OF_DAY instead of Calendar.HOUR.

    i.e., timePicker.setCurrentHour() always expects the argument in 24-hour format. Unfortunately, this fact is not documented properly in the API documentation.

提交回复
热议问题