Android Basic activity programming is basically written in three parts, namely the layout XML file under the Res/layout directory, the Java file under the src/package, and the Androidmanifest.xml file in the Res directory.
This is the three documents, the basic process is in layout. The XML file defines the interface layout, Then the Java file (a Java file represents an activity) makes a call to the Layout.xml file, writes the active principal code, and finally registers the activity in Androidmanifest.xml, and sets the primary activity (that is, the first activity opened by default). Like this.
First in First_layout. The XML layout file defines a button, the button ID is set to button_1, and the button name is set to 1.
Then override the OnCreate method in the Firstactivity.java file to load the first_layout. The XML layout file (OnCreate () method is the method that runs each time the activity is created and can be interpreted as a method of active initialization)
Requestwindowfeature (Window.feature_no_title) This line is to remove the active title bar because it takes up too many positions
You can see the space or save a large part of it. Of course, just writing to this step will not work, because you also need to go to the Androidmanifest.xml file to register the firstactivity activity.
Can see, ". Firstactivity "is actually the abbreviation for" com.test.blogtest.FirstActivity "because it is already in the same package by default, so it only needs to write". Firstactivity "It's OK.
The following Android:label is the title bar, can be seen at a glance, right.
The general activity does not need to define <intent_filter> this part, except the activity which needs certain starting condition, for example this is defines it as the main activity.
You can run the event here.
"Learn the first line of code." The next day
How to run Android activity