Template modification for Android Application development skills

Source: Internet
Author: User

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.

Figure 1 Figure 2

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)

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.