After a few weeks of learning in the Android class, I also learned a lot, the following to talk about what they learn and the problems encountered in the learning process.
First of all we start from the interface, the first to complete a simple interface, for the mobile phone application development interface will be used in the control, all the control base class is view, ViewGroup inherit from view, it can contain other view.
One.
1.TextView
Sets the width of the control, height
Set the color of text
Set the ID of the component
The use of the TextView control is first added to the layout file
2. Modify the value of an attribute in XML to control the representation of a control
3.EditText
These are the common properties of EditText controls
3.Button controls
There are several basic ways to use buttons:
(1) Add the button control to the XML layout file, or you can add it through the program
In the layout file to set some properties of the button, such as position, width height, button on the word, color, etc., it is important to give the button an ID, which is the button unique name.
(2) Handle the button's Click event
4. First complete the interface settings in XML and then write the Java language program in Java.
Make use of the IF condition statement to write the Java language Program, and then look at the running results.
Two. Some new gains and problems that cannot be solved
1. Previous assignments once to use the TextView, ImageView, RadioButton controls to implement a picture selector, display the corresponding picture by selecting the name of the flower.
At the top of the job the interface is set Piease Choose a flower you like the marquee effect
Setting up a marquee is a problem: The marquee text is set and cannot be run, and there is no way to change the speed and time of the marquee
Later on the text in the size of the font changed, the font set a little larger, as to the time and speed after Baidu was resolved.
2. Both the interface and the Java language have been completed, but a picture is displayed after running
Because a window of R was opened by mistake when writing a Java program
3. When completing the BMI app, the first is not to display the results with a toast, but to display the results in the interface, use the TextView control, and its SetText () method to set the value, the second is not entered to determine the null value, the app will flash back
There is also a main dialog box in 4.Android
To create a dialog box, follow these steps:
(1) Create a Builder object
(2) Set the parameters of the dialog to be created, such as several buttons, what to display, etc.
(3) Set the callback function for the button (because the dialog in Android are asynchronous, the callback function is required).
(4) Make builder generate dialog objects based on the settings in the previous steps.
(5) Use the show () method to display the dialog.
5. Monitoring Events
When writing in Java, define variables such as private EditText extizhong, and then establish related event ring extizhong= (EditText) Findviewby, should finally add the corresponding listener events, to implement the instructions you want to implement.
Android Learning Summary