意外的命名空间preFIX"的xmlns"发现标签的ListView [英] Unexpected namespace prefix "xmlns" found for tag ListView

查看:236
本文介绍了意外的命名空间preFIX"的xmlns"发现标签的ListView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在activity_main.xml中创建为主要活动的简单列表视图中添加RelativeLayout的下一个列​​表视图(请如果我错用术语原谅我。我非常新的Andr​​oid开发人员)。

I added a list view under RelativeLayout in activity_main.xml to create a simple list view for the main activity (please excuse me if I am using wrong terminology. I am very new to android dev).

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" >

    <ListView 
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/listview"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

</RelativeLayout>

这完美地工作了一段时间。结果
我注意到肯定我做了什么,因为我现在得到就行了红色的圆圈错误
        机器人:ID =@ + ID /列表视图
我得到的错误是:意外的命名空间preFIX的xmlns找到标签的ListView

This worked perfectly for some time.
I am note sure what I did because now I am getting a red error circle on the line android:id="@+id/listview" The error i am getting is: Unexpected namespace prefix "xmlns" found for tag ListView

Eclipse中不会让我编译即使它只是工作的项目。

Eclipse wont let me compile the project even though it was just working.

在此先感谢!

推荐答案

您可以删除
    的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
从你的列表视图的定义,它是只有一次的xml文件必须的。

You can remove the xmlns:android="http://schemas.android.com/apk/res/android" from your listview definition, it is only necessary once for the xml file.

    <ListView 
    android:id="@+id/listview"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />

XMLNS是您所定义的命名空间,在这种情况下,你是说在文件的开头说:机器人是联系在一起的命名空间在

xmlns is the namespace you are defining, in this case you are saying at the beginning of the file that "android" is linked to the namespace at

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

所以,当你正试图重新定义它的错误

so there is an error when you are attempting to redefine it

这篇关于意外的命名空间preFIX&QUOT;的xmlns&QUOT;发现标签的ListView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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