【问题标题】:Attribute is missing Android namespace prefix on listviewlistview 上的属性缺少 Android 命名空间前缀
【发布时间】:2013-11-20 21:14:29
【问题描述】:

我正在创建一个使用位于 res 文件夹下的 schedule_layout.xml 文件的 Android 应用程序,但我收到此错误,“Android 缺少 Android 命名空间前缀”。这是什么意思?我该如何解决?

<?xml version="1.0" encoding="utf-8"?>
<ListView
    android:id="@+id/schedule"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">
</ListView>

【问题讨论】:

标签: java android xml namespaces


【解决方案1】:

使用下面的

<?xml version="1.0" encoding="utf-8"?>
<ListView
    xmlns:android="http://schemas.android.com/apk/res/android" //missing
    android:id="@+id/schedule"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">
</ListView>

也检查一下

Why this line xmlns:android="http://schemas.android.com/apk/res/android" must be the first in the layout xml file?

【讨论】:

  • @koneko 欢迎您查看我帖子中的链接
【解决方案2】:

将以下属性添加到您的列表视图中:

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

这就像一个命名空间声明

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-08-20
    • 1970-01-01
    • 1970-01-01
    • 2011-09-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多