java - Eclipse XML 编辑器显示 android1 不是 android 并且没有自动完成

标签 java android xml eclipse

我正在使用 Eclipse 进行 Android 编程,今天当我打开继续我的应用程序开发时,xml 编辑器根本不知道 android 标签,例如 android:layout_....,它知道 android1 和自动完成不工作并说“元素未知”!

这是一个例子:

<TextView
    android1:id="@+id/textView1"
    android1:layout_width="wrap_content"
    android1:layout_height="wrap_content"
    android1:layout_alignRight="@+id/help"
    android1:textSize="20dp" />

有什么办法可以解决这个问题吗?

最佳答案

看来您可能弄乱了您的命名空间。因此,在 XML 布局文件中,将所有 xmlns: 标记替换为:

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

这应该位于您的顶级元素中,并且应该如下所示:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignRight="@+id/help"
        android:textSize="20dp" />

</RelativeLayout>

关于java - Eclipse XML 编辑器显示 android1 不是 android 并且没有自动完成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24724301/

相关文章:

java - 为什么 Spring 框架不允许 Autowiring 原始类型?

java - 将对象配对以包含来自 JSONArray 的 3 个值

Java Collection-ArrayList 和 Vector 之间的加速

Android 获取有关安装或删除的应用程序的广播

java - 在 Android 应用程序中添加 IMEI 号码?

php - 在 PHP 中查找不匹配的标签时遇到问题

java - 查找并替换两个模式字符串之间的子字符串

android - 在 Android Google Map v2 中为我的自定义标记添加发光效果

javascript - 添加引用现有命名空间的 XHTML 元素

java - 将转换后的 SOAP/XML 对象返回给 url