One of the biggest features of Android is the use of XML files to configure, this exercise of Java features. So, understand the Android program and need to understand the XML file.
We write programs that need to focus on androidmanifest.xml, and the XML files under Res/layout and Res/value.
First look at Androidmanifest.xml, the androidmanifest.xml of my program are as follows:
<?xml version= "1.0" encoding= "Utf-8"?>1 explains the version number, character set, which character sets are available in the world and can be checked online. <manifest package= "Workshop.english.englishwords"Android:versioncode= "1"2-4 it shows that the customary namespace in package,c++, in fact, is almost a meaning. Android:versionname= "1.0" xmlns:android= "http://schemas.android.com/apk/res/android" > <uses-sdk android:minsdkversion= "3"/>explains that the SDK version is 3 because I chose Android 1.5, so this is 3. The newer is the Android 4.0.3, the corresponding level is 15. This is selected when creating an app. <Application Android:icon= "@drawable/ic_launcher"describes the app in the Android desktop Display icon, the icon displayed in the Res/drawable directory ic_lancher.png, this can be changed, but the name must be drawable directory. Android:label= "@string/app_name" >describes the application display name, lable tag, corresponding app_name in the Res/values directory Strings.xml can be found.
11-28, lists three activity, three activity corresponds to three class name, here must be such a format, I have tried to prefix "." removed, resulting in an error. Feel this "." A bit like the identity of the current directory in the directory, which identifies the current namespace. The first activity and two different, most notably the Intent-filter segment, LINE15 and 17 indicate that this is the first activity to launch the app, is it a bit of a C language that has the flavor of the main function? You can also understand the entry for the application. At least one activity in each application is defined as main. Notice that the other two activity is not intent-filter, actually can have, but here my program is not used. About Intent-filter, the online also has a more detailed description, for the time being here also not detailed introduction. I will also summarize it later, because it can be used as a topic and contains a lot of content
<activity Android:name= ". Englishwordsactivity " android:label=" @string/app_name "> <intent-filter> < Action android:name= "Android.intent.action.MAIN"/> <category android:name= " Android.intent.category.LAUNCHER "/> </intent-filter> </activity> <activity Android:name= ". Unitlistadapter "> </activity> <activity android:name=". Wordactivity "> </activity> </application> </manifest>
First of all, what is the use of this file? Manifest, I do not know how to translate into Chinese, can only be understood. Writing a Java program is no stranger to the word. Can be seen as something like a manifest description. We all have the experience of online shopping, for product packaging, there will be a list of what is in this package. Here manifest is actually the meaning of the general.
This XML file, in fact, describes what our application is, and, of course, other instructions for running the environment.
It should be noted that Androidmanifest.xml is basically auto-generated and of course, we can also edit it. But you have to be careful when editing, and editing every element needs to figure out what he means, otherwise it can easily lead to mistakes. This I think is an android is not very good for the novice place. For this reason, I have explained this document in detail. To tell you the secret, I have suffered a loss.
About Android Androidmanifest.xml