Imitation Apple lock screen implementation

Source: Internet
Author: User


public class Lockactivity extends activity{@Overrideprotected void OnCreate (Bundle savedinstancestate) {//TODO Auto-gen Erated method Stubsuper.oncreate (savedinstancestate); Setcontentview (R.layout.lockscreen); InitUI ();} Public EditText edittext,edittext2,edittext3,edittext4;private void Initui () {EditText = (EditText) Findviewbyid ( R.ID.EDITTEXT1); editText2 = (EditText) Findviewbyid (r.id.edittext2); editText3 = (EditText) Findviewbyid ( R.ID.EDITTEXT3); editText4 = (EditText) Findviewbyid (R.ID.EDITTEXT4); Edittext.addtextchangedlistener (new Textwatcher () {@Overridepublic void ontextchanged (charsequence s, int start, int before, int count) {//TODO auto-generate D method stub} @Overridepublic void Beforetextchanged (charsequence s, int start, int count,int after) {//TODO Auto-generat Ed method stub} @Overridepublic void Aftertextchanged (Editable s) {//TODO auto-generated method stubstring resstring =edit Text.gettext (). toString (). Trim (); if (Resstring!=null && resstring.length () >0) {Edittext2.requestfocus ();}}); Edittext2.addtextchangedlistener (New Textwatcher () {@Overridepublic void ontextchanged (charsequence s, int start, int before, int count) {//TODO auto-generated method stub} @Overridepublic void Beforetextchanged (charsequence s, int start, I NT Count,int after) {//Todo auto-generated method stub} @Overridepublic void Aftertextchanged (Editable s) {//Todo Auto-ge Nerated method stubstring resstring =edittext2.gettext (). toString (). Trim (); if (Resstring!=null && Resstring.length () >0) {Edittext3.requestfocus ();}}); Edittext3.addtextchangedlistener (New Textwatcher () {@Overridepublic void ontextchanged (charsequence s, int start, int before, int count) {//TODO auto-generated method stub} @Overridepublic void Beforetextchanged (charsequence s, int start, I NT Count,int after) {//Todo auto-generated method stub} @Overridepublic void Aftertextchanged (Editable s) {//Todo Auto-ge Nerated method stubstring resstring =edittext3.gettext (). toString (). Trim (); if (resString!=null && resstring.length () >0) {Edittext4.requestfocus ();}}); Edittext4.addtextchangedlistener (New Textwatcher () {@Overridepublic void ontextchanged (charsequence s, int start, int before, int count) {//TODO auto-generated method stub} @Overridepublic void Beforetextchanged (charsequence s, int start, I NT Count,int after) {//Todo auto-generated method stub} @Overridepublic void Aftertextchanged (Editable s) {//Todo Auto-ge Nerated method stubstring resstring =edittext4.gettext (). toString (). Trim (); if (Resstring!=null && Resstring.length () >0) {//Hide keyboard Inputmethodmanager Imm = (inputmethodmanager) getsystemservice (Context.input_method _service); Imm.hidesoftinputfromwindow (Edittext4.getwindowtoken (), 0); Force hide Keyboard}});}}

The

layout is as follows:

<?xml version= "1.0" encoding= "Utf-8"? ><relativelayout xmlns:android= "http://schemas.android.com/apk/res/ Android "Android:layout_width=" Match_parent "android:layout_height=" match_parent "android:gravity=" Center_vertica         L "> <linearlayout android:layout_width=" match_parent "android:layout_height=" Wrap_content " android:orientation= "Horizontal" android:paddingright= "20DP" > <edittext android:id= "@+id/editt                Ext1 "android:layout_width=" Fill_parent "android:layout_weight=" 1 "android:layout_marginleft=" 20DP " android:layout_height= "Wrap_content" android:singleline= "true" android:ems= "1" android:i Nputtype= "Textpassword" > </EditText> <edittext android:id= "@+id/edittext2" android:layou T_width= "Fill_parent" android:layout_weight= "1" android:layout_marginleft= "20DP" Android:layout_heigh t= "Wrap_content" Android:siNgleline= "true" android:ems= "1" android:inputtype= "Textpassword" > </EditText> <edittext Android:id= "@+id/edittext3" android:layout_width= "Fill_parent" android:layout_weight= "1" Androi d:layout_marginleft= "20DP" android:layout_height= "Wrap_content" android:singleline= "true" Android:ems        = "1" android:inputtype= "Textpassword" > </EditText> <edittext android:id= "@+id/edittext4"        Android:layout_width= "Fill_parent" android:layout_weight= "1" android:layout_marginleft= "20DP" android:layout_height= "Wrap_content" android:singleline= "true" android:ems= "1" android:inputtype= "text Password "> </EditText> </LinearLayout></RelativeLayout>



Imitation Apple lock screen implementation

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.