为什么这条线的xmlns:安卓=" HTTP://schemas.android.com/apk/res/android"必须是第一个在布局XML文件? [英] Why this line xmlns:android="http://schemas.android.com/apk/res/android" must be the first in the layout xml file?

查看:2220
本文介绍了为什么这条线的xmlns:安卓=" HTTP://schemas.android.com/apk/res/android"必须是第一个在布局XML文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么这条线是需要在XML布局文件?

Why this line is needed in xml layout file ?

任何人都可以给我一个解释?

Can anybody give me an explanation?

我试图理解,但没有成功,所以我在这里张贴了这个问题。

I tried to understand, but not succeeded, so I post this question here.

推荐答案

在XML,XMLNS声明了一个命名空间。事实上,当你做的:

In XML, xmlns declares a Namespace. In fact, when you do:

<LinearLayout android:id>
</LinearLayout>

而不是调用的android:ID ,XML将使用<一个href="http://schemas.android.com/apk/res/android%3aid">http://schemas.android.com/apk/res/android:id是唯一的。一般来说这个页面不存在(这是一个URI,而不是URL),但有时它是解释所使用的命名空间的URL。

Instead of calling android:id, the xml will use http://schemas.android.com/apk/res/android:id to be unique. Generally this page doesn't exist (it's a URI, not a URL), but sometimes it is a URL that explains the used namespace.

该命名空间具有pretty的大致相同用途的Java应用程序包名称。

The namespace has pretty much the same uses as the package name in a Java application.

这里是一个解释。

统一资源标识符(URI)

Uniform Resource Identifier (URI)

一个统一资源标识符(URI)是字符的字符串,   标识互联网资源。

A Uniform Resource Identifier (URI) is a string of characters which identifies an Internet Resource.

最常见的URI是统一资源定位符(URL),其   标识互联网域名地址。另一种,不那么常见的类型   URI是统一资源名称(URN)。

The most common URI is the Uniform Resource Locator (URL) which identifies an Internet domain address. Another, not so common type of URI is the Universal Resource Name (URN).

在我们的例子中,我们将只使用网址。

In our examples we will only use URLs.

这篇关于为什么这条线的xmlns:安卓=&QUOT; HTTP://schemas.android.com/apk/res/android&quot;必须是第一个在布局XML文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆