显示时间选择器对话框

时间:2016-03-23 09:15:52

标签: android android-datepicker

如何实现日期选择器对话框,如下图所示。

提前致谢enter image description here

3 个答案:

答案 0 :(得分:1)

这取决于你的SDK版本。如果您确实需要在旧版Android上使用相同的外观,则可以使用此库。我以前用过它真棒!它需要API 14(冰淇淋三明治)
https://github.com/wdullaer/MaterialDateTimePicker

也许值得查看这个图书馆:
https://github.com/vikramkakkar/SublimePicker

答案 1 :(得分:0)

val tableData = sc.newAPIHadoopRDD(
  conf,
  classOf[GsonBigQueryInputFormat],
  classOf[LongWritable],
  classOf[JsonObject]).

显示时间选择器,

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
    }

答案 2 :(得分:0)

取决于你的分钟。 SDK!如果您有5.0或更多版本,此版本将其作为普通组件,但如果您的版本较少,则需要使用外部库。您可以找到此库,例如herehere

告诉我,如果我帮助你并做好编程!