AndroidManifest.xml
I came across the following two lines in AndroidMenifest.xml file of my android application:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
- Why we have write "encoding" in
<xml>
tag, what is the purpose of it? - What is the purpose of writing 2nd line ?
if开发者_JAVA百科 anybody know this, may share their knowledge to let me clear regarding this 2 lines
Thanx - paresh
Since you found out the first line by yourself, I'll explain you only the second. It just sets up the android
XML namespace. When using own resources, you should add their namespaces too, like:
xmlns:myapp="http://schemas.android.com/apk/res/com.mypackage
This will declare the myapp
namespace.
First line is not required for writing your xml, but it is good practice to have it as the first line of your XML and if you are using any other encoding then it becomes necessary.
Second line is required because manifest should be the root node of Android Manifest xml. And as a matter of fact it gets closed at the end of file by </manifest>
just like any other node.
精彩评论