. Net programmers play Android Development --- (3) login page layout,. netandroid

Source: Internet
Author: User

. Net programmers play Android Development --- (3) login page layout,. netandroid

In this section, let's take a look at the layout of the login page. For children's shoes that just came into contact with Android development, the layout of Android is tricky and needs to be set based on various attributes, next we will come from the dot-in-plane

To learn how to deploy pages in Android, the login page is very simple. There are two text boxes and one button. The page effects are as follows:

1. layout code

Click activity_mail.xml to view the layout code.

Click graphical Layout to switch to the design form.

All code

<LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android" android: orientation = "vertical" android: layout_width = "fill_parent" android: layout_height = "fill_parent"> <LinearLayout android: layout_width = "fill_parent" android: layout_weight = "0.9" android: layout_height = "fill_parent"> </LinearLayout> <LinearLayout android: layout_width = "fill_parent" android: layout_weight = "0.1" android: orientation = "vertical" android: layout_height = "fill_parent"> <LinearLayout android: layout_marginLeft = "10px" android: layout_marginRight = "10px" android: gravity = "center" android: layout_width = "fill_parent" android: orientation = "horizontal" android: layout_height = "wrap_content"> <TextView android: textSize = "8pt" android: text = "username" android: layout_weight = "0.75" android: layout_width = "fill_parent" android: layout_height = "wrap_content"> </TextView> <EditText android: layout_weight = "0.25" android: layout_width = "fill_parent" android: text = "Enter the user name" android: layout_height = "wrap_content"> </EditText> </LinearLayout> <LinearLayout android: layout_marginLeft = "10px" android: layout_marginRight = "10px" android: gravity = "center" android: layout_width = "fill_parent" android: orientation = "horizontal" android: layout_height = "wrap_content"> <TextView android: textSize = "8pt" android: text = "password" android: layout_weight = "0.75" android: layout_width = "fill_parent" android: layout_height = "wrap_content"> </TextView> <EditText android: layout_weight = "0.25" android: layout_width = "fill_parent" android: password = "true" android: text = "enter the password" android: layout_height = "wrap_content"> </EditText> </LinearLayout> <LinearLayout android: layout_marginLeft = "10px" android: layout_marginRight = "10px" android: gravity = "center" android: layout_width = "fill_parent" android: orientation = "horizontal" android: layout_height = "wrap_content"> <Button android: text = "login" android: textSize = "9pt" android: layout_width = "fill_parent" android: layout_height = "wrap_content"> </Button> </LinearLayout> <LinearLayout android: layout_marginLeft = "10px" android: layout_marginRight = "10px" android: gravity = "center" android: layout_width = "fill_parent" android: orientation = "horizontal" android: layout_height = "wrap_content"> <Button android: text = "register" android: textSize = "9pt" android: layout_width = "fill_parent" android: layout_height = "wrap_content"> </Button> </LinearLayout>


2. attribute description

Control Introduction

LinearLayout control: Linear layout control. As its name implies, it is displayed in a linear manner, including two linear modes: horizontal and total.

Android: orientation = "vertical" indicates the vertical direction, android: orientation = "horizontal" indicates the horizontal direction

TextView control: Display Control, similar to label Control

EditText control: text box control, similar to TextBox Control

Button Control

Attribute description

Layout_width: the width of the control relative to the parent container. There are three values: fill_parent wrap_content match_parent

Fill_parent indicates filling the entire screen width

Wrap_content indicates the width of the matched text

Android: orientation = "vertical" sets the horizontal and vertical directions

Android: orientation = "vertical" sets the left margin of the control

Android: layout_weight sets the percentage of controls

Android: gravity = "center" sets the element location in the control.

Android: layout_gravity refers to the position of the control in the parent control.


There are already too many other
C # confusions of programmers who develop website programs (answered by net programmers)

Programmers are not a job. Writing programs in China must become an interest and pursuit before they can stick to the end. If not, do not get involved.

How can JAVA programmers and C #/NET programmers develop Android applications faster?

If the source code of java is faster, if a tool like perfect e is used,. net will be faster.

Related Article

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.