what's the story with the android XML namespac

2019-06-26 02:59发布

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"

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

The android: namespace is actually included under the locally-installed 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.

Peter

1条回答
在下西门庆
2楼-- · 2019-06-26 03:30

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.

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.

查看更多
登录 后发表回答