Is a man next layer 100 [the first layer] -- high imitation WeChat interface (3)

Source: Internet
Author: User

The previous article "is a man on the next layer [the first layer] -- high imitation interface (2)" implements the registration logon interface. This article shows the specific logon interface implementation, let's take a look at the interface effect.


Logon page layout

<? Xml version = "1.0" encoding = "UTF-8"?> <RelativeLayout xmlns: android = "http://schemas.android.com/apk/res/android" android: layout_width = "fill_parent" android: layout_height = "fill_parent" android: background = "# eee" android: orientation = "vertical" android: gravity = "center_horizontal"> <RelativeLayout android: id = "@ + id/login_top_layout" android: layout_width = "fill_parent" android: layout_height = "45dp" android: layout_alignParentTop = "true" android: B Ackground = "@ drawable/title_bar"> <Button android: id = "@ + id/login_reback_btn" android: layout_width = "70dp" android: layout_height = "wrap_content" android: layout_centerVertical = "true" android: text = "back" android: textSize = "14sp" android: textColor = "# fff" android: onClick = "login_back" android: background = "@ drawable/title_btn_back"/> <TextView android: layout_width = "wrap_content" android: layout_height = "wrap_cont Ent "android: layout_centerInParent =" true "android: textSize =" 20sp "android: textStyle =" bold "android: textColor =" # ffffff "android: text = "login"/> </RelativeLayout> <EditText android: id = "@ + id/login_user_edit" android: layout_width = "fill_parent" android: layout_height = "wrap_content" android: layout_below = "@ + id/login_top_layout" android: textColor = "#000" android: textSize = "15sp" android: layout_marginTop = "25dp" Ndroid: layout_marginLeft = "20dp" android: layout_marginRight = "20dp" android: singleLine = "true" android: background = "@ drawable/login_editbox" android: hint = "QQ/mobile phone number (enter buaa)"/> <EditText android: id = "@ + id/login_passwd_edit" android: layout_width = "fill_parent" android: layout_height = "wrap_content" android: layout_below = "@ + id/login_user_edit" android: textColor = "#000" android: textSize = "15sp" android: layout_ma RginTop = "25dp" android: layout_marginLeft = "20dp" android: layout_marginRight = "20dp" android: background = "@ drawable/login_editbox" android: password = "true" android: singleLine = "true" android: hint = "password (enter 123)"/> <RelativeLayout android: layout_width = "fill_parent" android: layout_height = "wrap_content" android: layout_marginTop = "20dp" android: layout_below = "@ + id/login_passwd_edit"> <Button android: id = "@ + id/ Get_passwd "android: layout_width =" wrap_content "android: layout_height =" wrap_content "android: layout_marginLeft =" 23dp "android: layout_marginTop =" 5dp "android: text =" forgot password? "Android: textSize =" 16sp "android: textColor =" # 00f "android: background =" #0000 "android: onClick =" login_pw "/> <Button android: id = "@ + id/login_login_btn" android: layout_width = "90dp" android: layout_height = "40dp" android: layout_marginRight = "20dp" android: layout_alignParentRight = "true" android: text = "login" android: background = "@ drawable/btn_style_green" android: textColor = "# ffffff" android: textSize = "18sp" android: onClick = "login_mainweixin"/> </RelativeLayout>
In the above interface, you must note that the background resource file of the "return" button

<?xml version="1.0" encoding="UTF-8"?><selector  xmlns:android="http://schemas.android.com/apk/res/android">    <item android:state_focused="true" android:drawable="@drawable/mm_title_back_focused" />    <item android:state_pressed="true" android:drawable="@drawable/mm_title_back_pressed" />    <item android:state_selected="true" android:drawable="@drawable/mm_title_back_pressed" />    <item android:drawable="@drawable/mm_title_back_normal" /></selector>
I have already seen it in the previous article, so I won't be embarrassed here

Background layout file in the input box

<?xml version="1.0" encoding="UTF-8"?><selector  xmlns:android="http://schemas.android.com/apk/res/android">    <item android:state_focused="true"  android:drawable="@drawable/login_edit_pressed" />    <item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/login_edit_pressed" />    <item android:state_focused="false" android:drawable="@drawable/login_edit_normal" /></selector>
The background for obtaining focus is different from that for losing focus.

Next, process the data checksum and redirect

Public void login_mainweixin (View v) {if ("dawanganban ". equals (mUser. getText (). toString () & "123456 ". equals (mPassword. getText (). toString () // determines the account and password {Intent intent = new Intent (); intent. setClass (Login. this, LoadActivity. class); startActivity (intent); // Toast. makeText (getApplicationContext (), "Logon successful", // Toast. LENGTH_SHORT ). show ();} else if ("". equals (mUser. getText (). toString () | "". equals (mPasswo Rd. getText (). toString () // determines the account and password {new AlertDialog. builder (Login. this ). setIcon (getResources (). getDrawable (R. drawable. login_error_icon )). setTitle ("Logon error "). setMessage ("the account or password cannot be blank. \ n please enter it and log on again! "). Create (). show ();} else {new AlertDialog. builder (Login. this ). setIcon (getResources (). getDrawable (R. drawable. login_error_icon )). setTitle ("Logon Failed "). setMessage ("incorrect account or password, \ n please check and enter again! "). Create (). show ();}}
Click forgot password. Skip to a page.

Public void login_pw (View v) {// Uri uri = Uri for the forgot password button. parse ("http://blog.csdn.net/dawanganban"); Intent intent = new Intent (Intent. ACTION_VIEW, uri); startActivity (intent );}
There is also a return button to directly close the current Activity

Public void login_back (View v) {// this. finish ();}
Running result:




Source code download: http://download.csdn.net/detail/lxq_xsyu/6966767

Next article: http://blog.csdn.net/dawanganban/article/details/20079141


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.