简体   繁体   English

属性在listview上缺少Android名称空间前缀

[英]Attribute is missing Android namespace prefix on listview

I am creating an android app which uses a schedule_layout.xml file located under the res folder but I'm getting this error, "Android is missing Android namespace prefix". 我正在创建一个Android应用程序,它使用位于res文件夹下的schedule_layout.xml文件,但我收到此错误,“Android缺少Android名称空间前缀”。 What does it mean? 这是什么意思? How can I fix it? 我该如何解决?

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

add the following attribute to your list view: 将以下属性添加到列表视图中:

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

it's like a namespace declaration 它就像一个命名空间声明

Use the below 使用以下

<?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>

Also check this 还检查一下

Why this line xmlns:android="http://schemas.android.com/apk/res/android" must be the first in the layout xml file? 为什么这行xmlns:android =“http://schemas.android.com/apk/res/android”必须是布局xml文件中的第一个?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM