开发者

how to show dialog to pick date and time togather?

i am using following code to show date picker in android

DatePickerDialog dial= new DatePickerDialog(this.getContext(),0,mDateSetListener,thisYear,thisMonth,thisDay);
            dial.setOnDismissListener(new OnDismissListener() {

                @Override
                public void onDismiss(DialogInterface arg0) {

                    // dismiss it.

                }
            });
dial.show();

now i want to pick time too alo开发者_如何学Pythonng with date any one guide me how to achieve this?


Step #1: Create a dialog (e.g., use AlertDialog.Builder).

Step #2: Put a DatePicker and a TimePicker in the dialog (e.g., setView() on AlertDialog.Builder).

Note that this may not work well on small screens, since DatePicker and TimePicker are each large -- there may not be enough room for both and the dialog buttons and such.


As said you can create a dialog with both in however on most screens it will look poor due to the size of them. You could recreate your own making it smaller (it's not that hard) or reflow your app and have them on separate pop-ups

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜