Android--slidedatetimepicker Time Control app

Source: Internet
Author: User

Download the reference Slidedatetimepicker time picker

1. Create

begintimetxt=(EditText) Findviewbyid (R.id.search_begintime_edittext); Endtimetxt=(EditText) Findviewbyid (R.id.search_endtime_edittext); Begintimetxt.setonclicklistener (NewMysearchclicklistener ()); Begintimetxt.setontouchlistener (NewView.ontouchlistener () { Public BooleanOnTouch (View V, motionevent event) {Begintimetxt.setinputtype (inputtype.type_null);//turn off the soft keyboard                return false;        }        }); Endtimetxt.setonclicklistener (NewMysearchclicklistener ()); Endtimetxt.setontouchlistener (NewView.ontouchlistener () { Public BooleanOnTouch (View V, motionevent event) {Endtimetxt.setinputtype (inputtype.type_null);//turn off the soft keyboard                return false; }        });

2. Monitoring Events

    classMysearchclicklistenerImplementsView.onclicklistener {@Override Public voidOnClick (view view) {Switch(View.getid ()) {//Start Time                 CaseR.id.search_begintime_edittext:NewSlidedatetimepicker.builder (Getsupportfragmentmanager ()). Setlistener (Mybegindatetimeliste NER). Setinitialdate (NewDate ())//. Setmindate (mindate)//. Setmaxdate (maxdate)//. Setis24hourtime (True)//. SetTheme (Slidedatetimepicker.holo_dark)//. Setindicatorcolor (Color.parsecolor ("#990000")). Build (). Show ();  Break; //End Time                 CaseR.id.search_endtime_edittext:NewSlidedatetimepicker.builder (Getsupportfragmentmanager ()). Setlistener (Myenddatetimelistene R). Setinitialdate (NewDate ())//. Setmindate (mindate)//. Setmaxdate (maxdate)//. Setis24hourtime (True)//. SetTheme (Slidedatetimepicker.holo_dark)//. Setindicatorcolor (Color.parsecolor ("#990000")). Build (). Show ();  Break; }}} Slidedatetimelistener Mybegindatetimelistener=NewSlidedatetimelistener () {@Override Public voidondatetimeset (date date) {Begintimetxt.settext (Mtimeformat.format (date). ToString ());    }    }; Slidedatetimelistener Myenddatetimelistener=NewSlidedatetimelistener () {@Override Public voidondatetimeset (date date) {Endtimetxt.settext (Mtimeformat.format (date). ToString ()); }    };

Android--slidedatetimepicker Time Control app

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.