Look first.
How to use
Import Java.text.dateformat;import Java.text.parseexception;import Java.text.simpledateformat;import Java.util.calendar;import Android.app.activity;import Android.app.alertdialog;import Android.content.dialoginterface;import Android.os.bundle;import Android.view.layoutinflater;import Android.view.view;import Android.view.view.onclicklistener;import Android.widget.button;import Android.widget.edittext;public class Mainactivity extends Activity {wheelmain wheelmain; EditText Txttime;dateformat DateFormat = new SimpleDateFormat ("Yyyy-mm-dd"); @Overridepublic void OnCreate (Bundle Savedinstancestate) {super.oncreate (savedinstancestate); Setcontentview (r.layout.main); txttime = (EditText) Findviewbyid (R.id.txttime); Calendar calendar = Calendar.getinstance (); Txttime.settext (Calendar.get (calendar.year) + "-" + (Calendar.get ( Calendar.month) + 1) + "-" + calendar.get (calendar.day_of_month) + ""); Button Btnselecttime = (button) Findviewbyid (R.id.button1); Btnselecttime.setonclicklistener (New onclicklistEner () {@Overridepublic void OnClick (View arg0) {Layoutinflater inflater = Layoutinflater.from (mainactivity.this); Final View Timepickerview = inflater.inflate (R.layout.timepicker, NULL); Screeninfo screeninfo = new Screeninfo (mainactivity.this); wheelmain = new Wheelmain (Timepickerview, true); Wheelmain.screenheight = Screeninfo.getheight (); String time = Txttime.gettext (). toString (); Calendar calendar = Calendar.getinstance (), if (Judgedate.isdate (Time, "YYYY-MM-DD")) {try {calendar.settime ( Dateformat.parse (time));} catch (ParseException e) {//TODO auto-generated catch Blocke.printstacktrace ();}} int year = Calendar.get (calendar.year), int month = Calendar.get (calendar.month); int day = Calendar.get (calendar.day_of_ MONTH); int h = Calendar.gettime (). getHours (); int m = Calendar.gettime (). getminutes (); Wheelmain.initdatetimepicker ( Year, month, day, H, M), new Alertdialog.builder (Mainactivity.this). Settitle ("Select Time"). Setview (Timepickerview). Setpositivebutton ("OK", new Dialoginterface.onclicklistener () {@Overridepublic void OnClick (Dialoginterface dialog,int which) {Txttime.settext (Wheelmain.gettime ());}}). Setnegativebutton ("Cancel", new Dialoginterface.onclicklistener () {@Overridepublic void OnClick (Dialoginterface dialog, int which) {}}). Show ();}});}}
SOURCE download
Android Imitation iphone date time picker