xmlns:android的作用

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 theXMLConstants.XMLNS_ATTRIBUTE ("xmlns") in the Namespace declaration

example:<element xmlns:prefix="http://Namespace-name-URI">

在这我就不翻译了,不过从最后的一个example中我们可以看出,这类似是一个xml中的属性文件。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值