Simple design of Android user registration interface

This example shares the design of Android user registration interface for your reference. The specific contents are as follows

1. The instance target designs a user registration interface, in which some basic controls are used, such as text box, edit box, button, check box and so on

II. Technical analysis first uses the tag of the control in the layout file to configure each required control, then obtains the control in the main activity, adds a listener to it to listen to its operation, and finally outputs the operated content on the console.

3. The implementation step creates an Android project in eclipse with the name testuserregister. Design a user registration interface, in which you want to use text box, edit box, button, radio button, check box, list selection box, list view, picture view and other controls.

(1) Drawable in the res directory of the project_ In the LDPI folder, put two pieces with the names of logo5 Jpg and background3 Jpg image, used as the displayed logo image and background image.

(2) Create a new array resource file arrays. In the RES / values directory of the project XML, add two string arrays named type and care to the file, and the code is as follows

(3) Modify the activity in the RES / layout directory of the project_ main. XML file, first change the overall layout of the interface to the table layout, and set the background, and then add an image view as the logo image display. The code is as follows:

In the above code, the Android: adjustviewboundaries property is used to set whether the ImageView adjusts its boundary to maintain the length change of the required display picture. When true, it means to adjust its boundary to maintain the length change of the required display picture; Android: maxwidth and Android: maxheight represent the maximum width and maximum height of the ImageView, respectively.

(4) Add three tablerow table rows, and add three textview and EditText controls to display and fill in the user name, password and confirmation password. The specific codes are as follows:

In the above code, Android: singleline = "true" in EditText control means single line input text, and Android: inputtype = "textpersonname" means the input type is user name. Android: inputtype = "textpassword" means that the input content is a password, which will use "." Replace the input content to avoid password disclosure.

(5) Add a linear layout in which a text box control (textview) and a radio button group (radiogroup) are added. Add two radio button controls in the radio button group. The Android: orientation property of the linear layout is set to "horizontal". The specific code is as follows

(6) Add a linear layout in which a textview and a spinner are added. The Android: orientation property of the linear layout is set to "horizontal", and the Android: entries property of the list selection box is "@ array / type". The code is as follows

(7) Add a text box control (textview), list view control (listview), check box control( Check@R_53_2419 @) and a common button control. The code is as follows

In the above code, Android: gravity = "center" of textview control_ Horizontal "indicates that the text box control is placed horizontally in the screen; The Android: visibility property in the normal button indicates whether the control is visible. Here, it is set to invisible.

(8)activity_ main. XML file complete code

(9) In mainactivity Java file, get the check box control, ordinary button control, radio button group control and list selection box control, and add listeners for them. The code is as follows

In the above code, the location of the selected content is obtained through the listener of the drop-down list box control, and then assigned to the location variable; In the listener of the check box control, if the check box is selected, the registration button is visible, otherwise it is not visible.

4. Run

Before filling in information

Fill in the information and click Register

Console output information

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>