1.xmlns:android是一個XML命名空間,告訴Android開發工具你準備使用Android命名空間裏的一些通用屬性。在所有Android XML設計文件中最外層的標記必須使用這個樹形。
它可以提示你輸入什麼,不該輸入什麼,什麼是對的,什麼是錯的,也可以理解爲語法文件。或者語法判斷器什麼的。
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical|center_horizontal"
android:text="translucent_background"
/>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.com.fblife"
android:versionCode="1"
android:versionName="1.0">
......
</manifest>
2.當然在android Developers(開發者文檔)中也有寫到,
Interface for read only XML Namespace context processing.
An XML Namespace has the properties:
- Namespace URI: Namespace name expressed as a URI to which the prefix is bound
- prefix: syntactically, this is the part of the attribute name following the
XMLConstants.XMLNS_ATTRIBUTE
("xmlns") in the Namespace declaration
example:<element xmlns:prefix="http://Namespace-name-URI">
在這我就不翻譯了,不過從最後的一個example中我們可以看出,這類似是一個xml中的屬性文件。