Template modification for Android Application development skills
Author: Li Mingzhi,Embedded training instructor.
When developing Android applications, we will use the templates provided by eclipse to create a new project. After the project is created, the project contains a lot of content written based on the model, such as mainactivity In the src directory. java file (Figure 1), activity_main.xml in the layout directory (Figure 2), and so on
(Figure 1)
(Figure 2)
In this case, we will find some files that are not commonly used.Code, There are some common code does not exist, then we need to modify or add it ourselves. It is inconvenient to modify every generation. Find a solution to this problem. The following describes how to modify the layout template in Figure 2.
After searching, there is a Templates folder under the tools directory in the SDK.
The most familiar file is the activities file name. after entering the file, you will find that you are familiar with it. Figure 1 shows the content of the activities directory, and figure 2 shows a selection interface when you create a new project.
At this time, we felt a little bright and continued. When we opened the activities \ blankactivity \ root directory, we felt cordial again and found that it was the same as the Department file in the project.
To modify the layout file, you must enter the layout folder under the res directory, as shown in
After activation, we found that activity_simple.xml.ftl may be the content we want to modify.
Let's make a simple modification as follows:
Save the changes (due to the ADT plug-in problem, the other two files are modified according to your actual situation). Let's create a new project to check the effect, as shown below:
Our results have been achieved.
Knowledge is shared, and sharing is a virtue. (Huaqing vision Android training internal materials)