【问题标题】:how to access http://schemas.android.com/apk/res/android?如何访问 http://schemas.android.com/apk/res/android?
【发布时间】:2020-09-19 14:51:24
【问题描述】:

在开发android时,我们通常在开发布局文件时使用xml。

示例)

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
...

当时我有一个疑问。 如何访问http://schemas.android.com/apk/res/android

当我找到一些信息时。 我知道那不是 URL,而是 URI。所以不能通过互联网访问。那么命名空间信息在哪里呢?如何访问这些信息?

【问题讨论】:

标签: android xml android-layout xml-namespaces


【解决方案1】:

根据Namespaces in XML 1.0 (Third Edition),以下 URI 是一个命名空间名称

http://schemas.android.com/apk/res/android

3 Declaring Namespaces部分中声明:

命名空间名称,为了达到其预期目的,应该具有唯一性和持久性的特征。它不是直接可用于检索模式(如果存在)的目标。

一些 XML 没有架构。在这样的 XML 中,你不能拥有它。

命名空间名称的目标是避免元素名称和属性名称发生冲突。 XML 使用 URI 作为命名空间名称,因为它们具有唯一性和持久性。

【讨论】:

  • 感谢您的评论。
猜你喜欢
  • 1970-01-01
  • 2017-09-28
  • 2016-11-04
  • 2013-12-07
  • 1970-01-01
  • 2021-07-31
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多