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
精彩评论