未找到xml和Namespace中的Android Studio Unknown属性

时间:2013-06-20 04:24:52

标签: android xml android-layout android-studio

我最近在Layout和清单文件中收到了此警告。 我已将这些图片附在下面,只是检查一下,以便进一步澄清。

问题是我得到Namespace“没有绑定警告,我不能使用自动完成代码的xml文件,这通常可以在android studio中使用。请帮助解决这个问题。 为每个android属性显示未知的xml属性警告。

http://i39.tinypic.com/2rr55k1.png

http://i41.tinypic.com/2ns2s0w.png

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout
              xmlns:android="http://schemas.android.com/apk/res/android"
              android:orientation="vertical"
              android:layout_width="match_parent"
              android:layout_height="match_parent"

              >
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/blue"

            >
    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="text"
        android:textColor="@android:color/white"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:layout_margin="10dp"
        android:layout_above="@+id/editText"
        android:layout_alignLeft="@+id/editText"
        android:layout_marginBottom="15dp"/>
    <EditText
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:inputType="number"
            android:ems="15"
            android:padding="10dp"
            android:id="@+id/editText" android:layout_gravity="center"
            android:layout_centerInParent="true"
            android:background="@color/white"/>
    </RelativeLayout>

</RelativeLayout>

5 个答案:

答案 0 :(得分:17)

遇到同样的问题。我认为Android Studio 3.2有一些与此相关的特定错误。我在Windows上的解决方案是使用.AndroidStudio3.2 /文件夹中的cache /文件夹删除所有内容。

我尝试了别人提到的所有内容,同步gradle文件,使缓存无效,删除了整个项目,然后再次添加了它。对我唯一有效的方法是重新安装Android Studio。我第二次遇到这种情况,我决定寻找一种比重新安装整个Android Studio更好的解决方案。开始播放缓存文件,并发现删除Android Studio配置文件夹中cache /文件夹下的所有内容都可以解决问题。

答案 1 :(得分:15)

这很简单。删除.caches文件:

  1. 只需关闭您的AS。
  2. 转到.AndroidStudio3.2文件夹。
  3. 删除缓存文件(路径为:C:\Users\user\.AndroidStudio3.2\system
  4. 重新启动您的AS。
  5. 享受。

答案 2 :(得分:11)

这是Android studio缓存的问题。

最有可能将项目与gradle文件同步将有助于

re sync from here

如果不是,您可以手动删除位于$ HOME / .AndroidStudioX.X / system / caches上的缓存文件并重建项目。

答案 3 :(得分:1)

要“使用Gradle文件同步项目”,您无需更改文件中的任何内容。如果您使用的是Mac,则只需输入cmd + fn + F9或cmd + shift + a(搜索操作并输入双引号之间的内容)。 Android Studio上还有一个漂亮的图标。

答案 4 :(得分:1)

100%工作

执行以下两个步骤:

  1. 转到您的Android Studio缓存所在的文件夹。 我有android studio 3.6.3 对我来说是C:\Users\User_folder\.AndroidStudio3.6\system\caches
  2. 转到您的android studio项目所在的文件夹。 打开项目> .idea文件夹,然后删除缓存。 对我来说C:\Users\User_folder\AndroidStudioProjects\Project_name\.idea\caches