DateTime picker in android application [closed]

2019-01-10 02:18发布

Is there any android widget that enable to pick the date and the time at the same time ? I already use the basic time picker and date picker.

But they are not that sexy and user friendly (I found). Do you know if a widget including both date and time exists? Thanks a lot, Luc

15条回答
劫难
2楼-- · 2019-01-10 02:35

The URLs you link to show how to pop up a dialog with a time picker and another dialog with a date picker. However you need to be aware that you can use those UI widgets directly in your own layout. You could build your own dialog that includes both a TimePicker and DatePicker in the same view, thus accomplishing what I think you are looking for.

In other words, instead of using TimePickerDialog and DatePickerDialog, just use the UI widgets TimePicker and DatePicker directly in your own dialog or activity.

查看更多
一夜七次
3楼-- · 2019-01-10 02:36

I also wanted to combine a DatePicker and a TimePicker. So I create an API to handle both in one interface! :)

https://github.com/Kunzisoft/Android-SwitchDateTimePicker

enter image description here

You can also use SublimePicker

查看更多
在下西门庆
4楼-- · 2019-01-10 02:37

combined DatePicker and TimePicker in DialogFragment for Android

I created a library to do this. It also has customizable colors!

It's very simple to use.

First you create a listener:

private SlideDateTimeListener listener = new SlideDateTimeListener() {

    @Override
    public void onDateTimeSet(Date date)
    {
        // Do something with the date. This Date object contains
        // the date and time that the user has selected.
    }

    @Override
    public void onDateTimeCancel()
    {
        // Overriding onDateTimeCancel() is optional.
    }
};

Then you create and show the dialog:

new SlideDateTimePicker.Builder(getSupportFragmentManager())
    .setListener(listener)
    .setInitialDate(new Date())
    .build()
    .show();

I hope you find it useful.

查看更多
Viruses.
5楼-- · 2019-01-10 02:38

I was facing the same problem in one of my projects and have decided to make a custom widget that has both the date and the time picker in one user-friendly dialog. You can get the source code along with an example at http://code.google.com/p/datetimepicker/. The code is licensed under Apache 2.0.

查看更多
聊天终结者
6楼-- · 2019-01-10 02:38

I have create a alert dialog which combine Date picker and Time picker. You can get code at https://github.com/nguyentoantuit/android Note: DateTimePicker is a library

查看更多
欢心
7楼-- · 2019-01-10 02:40

I wrote up a little widget that allows you to pick both date and time.

DateTimeWidget

enter image description here

查看更多
登录 后发表回答