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

Source: Internet
Author: User

Next, the previous article "is the next layer of men [the first layer]-high imitation interface (1)", this article intends to implement the second interface in the previous article, in this article, we will first implement the login interface. Next we will start creating the login interface.

Interface layout file:

<? Xml version = "1.0" encoding = "UTF-8"?> <LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android" android: id = "@ + id/linearLayout1" android: layout_width = "fill_parent" android: layout_height = "fill_parent" android: gravity = "center" android: orientation = "vertical" android: background = "# eee"> <LinearLayout android: layout_width = "match_parent" android: layout_height = "wrap_content" android: gravity = "center"> <ImageView android: layout_width = "80dp" android: layout_height = "80dp" android: src = "@ drawable/copyright"/> <TextView android: layout_width = "wrap_content" android: layout_height = "wrap_content" android: layout_marginLeft = "10dp" android: text = "" android: textColor = "#000000" android: textSize = "35sp"/> </LinearLayout> <TextView android: layout_width = "fill_parent" android: layout_height = "wrap_content" android: layout_marginTop = "20dp" android: gravity = "center" android: text = "CSDN sunshine Xiaoqiang" android: textColor = "#000" android: textSize = "30dp"/> <Button android: id = "@ + id/main_login_btn" android: layout_width = "wrap_content" android: layout_height = "wrap_content" android: background = "@ drawable/btn_style_green" android: gravity = "center" android: paddingLeft = "130dp" android: paddingRight = "130dp" android: layout_marginTop = "15dp" android: text = "login" android: textColor = "# ffffff" android: textSize = "18sp"/> <TextView android: layout_width = "wrap_content" android: layout_height = "wrap_content" android: padding = "6dp" android: text = "Log on with the QQ number or number" android: textSize = "14sp" android: textColor = "#444"/> <Button android: id = "@ + id/main_regist_btn" android: layout_width = "wrap_content" android: layout_height = "wrap_content" android: layout_marginTop = "20dp" android: background = "@ drawable/btn_style_white" android: gravity = "center" android: paddingLeft = "130dp" android: paddingRight = "130dp" android: text = "register" android: textColor = "#000000" android: textSize = "18sp"/> <TextView android: layout_width = "wrap_content" android: layout_height = "wrap_content" android: padding = "6dp" android: gravity = "center" android: text = "[Click to jump to the main interface] \ n if you do not have a QQ number, register" android: textSize = "14sp" android: textColor = "#444"/> </LinearLayout>

In the above layout, it is worth noting that the background of the Button is a custom drawable resource file.

<?xml version="1.0" encoding="UTF-8"?><selector  xmlns:android="http://schemas.android.com/apk/res/android">    <item android:state_enabled="false" android:drawable="@drawable/btn_style_one_disabled" />    <item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/btn_style_one_pressed" />    <item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/btn_style_one_pressed" />    <item android:state_focused="true" android:drawable="@drawable/btn_style_one_focused" />    <item android:state_focused="false" android:drawable="@drawable/btn_style_one_normal" /></selector>
Set the four states of the background image (here the picture is 9patch, see: http://blog.csdn.net/dawanganban/article/details/17379193 for details)

Create an Activity

public class LoginActivity extends Activity{@Overrideprotected void onCreate(Bundle savedInstanceState) {// TODO Auto-generated method stubsuper.onCreate(savedInstanceState);setContentView(R.layout.activity_login);}}
Start LoginActivity in AppStart written in the previous article

public class AppStart extends Activity {@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_start);new Handler().postDelayed(new Runnable(){@Overridepublic void run(){Intent intent = new Intent (AppStart.this,LoginActivity.class);startActivity(intent);AppStart.this.finish();}}, 1000);}}
Running effect:


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

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

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.