什么是与Android的XML命名空间的故事吗? [英] what's the story with the android XML namespace?

查看:170
本文介绍了什么是与Android的XML命名空间的故事吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当您第一次使用的名称从Android XML命名空间,你不得不说哪里可以找到它,在这样的XML属性:

When you first use a name from the android XML namespace, you have to say where to find it, with an attribute in XML like this:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

不过,URL是404 - 没有发现有

However, that URL is a 404 - nothing found there.

在android:命名空间实际上是包含在本地安装SDK下

The android: namespace is actually included under the locally-installed SDK.

那么是什么回事?为什么我需要包括一个死网址?为什么不构建系统从像所有其他库SDK把它捡起来?

So what's going on here? Why do I need to include a dead URL? Why doesn't the build system pick it up from the SDK like all the other libraries?

谢谢,只是为了寻找在这个后面的故事。

Thanks, just looking for the back story on this.

彼得

推荐答案

这是XML坏的设计决策中的一个,使用URI的原因是,它会很容易地保证他们是独一无二的。这是设计缺陷,用户期望它们指向的地方找到的东西。他们这样做不是在这种情况下。

This is one of the bad design decisions in XML, the reason for using URIs was that it would be easy to guarantee that they were unique. This is the design flaw, users expect for them to point somewhere to locate something. They don't in this case.

这它们可以被用于定位资源的事实是一种偶然的。当你意识到他们只是唯一的字符串,然后包括在不同的SDK定义文件变得浑然天成。

The fact that they can be used for locating resources is kind of incidental. When you realize that they are just unique strings then including the definition files in a different SDK becomes totally natural.

这篇关于什么是与Android的XML命名空间的故事吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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