xml中的Android Studio未知属性和命名空间未找到 [英] Android Studio Unknown attribute in xml and Namespace not found

查看:23
本文介绍了xml中的Android Studio未知属性和命名空间未找到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近在 Layout 和清单文件中收到了这个警告.我在下面附上了这些图片,只是检查一下,以备进一步说明.

I recently got this warning in Layout and manifest files. I have attached those images below just check those in case for further clarification.

问题是我收到 Namespace " is not bound 警告,我不能使用 xml 文件的自动完成代码,这通常可以在 android studio 中使用.请帮助解决这个问题.为每个 android 属性显示未知的 xml 属性警告.

The problem is I'm getting Namespace " is not bound warning and I cannot use the autocomplete code for xml files which can be generally used in android studio.Please help for this issue. The unknown xml attribute warning is displayed for each and every android attribute.

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

推荐答案

很简单.删除 .caches 文件:

It is very simple. Delete .caches file:

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

注意:此解决方案适用于 Android Studio 4+

如果您使用的是 Android Studio 3+ 则从以下路径删除缓存

C:\Users\user.AndroidStudio3.x\system\caches

C:\Users\user.AndroidStudio3.x\system\caches

这篇关于xml中的Android Studio未知属性和命名空间未找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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