I have used TimePicker to make the user to choose time see here and here also. But I didnot find a way to make the user to select second also. Now user can select Hour and Minute but not second. If I want to set a time for 02:05:10 then what I have to do? How to pick a second using TimePicker?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
I think the best solution is to create your own TimePicker, by using the Time-class and three NumberPickers.
回答2:
I've published an open source project on GitHub which has TimePicker with seconds:
https://github.com/IvanKovac/TimePickerWithSeconds
Have a look.
回答3:
One quick and dirty way is to use two TimePickers, One for hours,minutes, and use the minutes on the other one as secunds. Hide the unused hours under the first minutes. This only works in 24 hour mode. Must declare timepicker for seconds first so locates under.
<RelativeLayout
<TimePicker
android:id="@+id/timePicker_Sec"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="76dp" />
<TimePicker
android:id="@+id/timePicker"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/timePicker_Sec"
android:layout_marginLeft="0dp" />
</RelativeLayout>