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 }}解决方法 我有同样的问题.然后我读取TimePicker源代码.我想我们无法在.java文件中更改timepicker模式. Google设置TimePicker模式的方法: http://prntscr.com/blkkkd 总结
以上是内存溢出为你收集整理的Android – 如何以编程方式更改时间戳模式?全部内容,希望文章能够帮你解决Android – 如何以编程方式更改时间戳模式?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)