首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >布局中的布局<layout>在基本布局文件夹中没有声明[错误]

布局中的布局<layout>在基本布局文件夹中没有声明[错误]
EN

Stack Overflow用户
提问于 2018-09-28 10:56:07
回答 26查看 73.4K关注 0票数 135

迁移到Android Studio 3.2,API 28后,我的应用布局出现以下错误:

布局中的布局在基本布局文件夹中没有声明;在与此限定符不匹配的配置中查询资源时,这可能会导致崩溃

我得到这个错误的一个布局是:

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    android:background="@null" >

      <FrameLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical" >

        <ImageView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="top|center_horizontal"
            android:adjustViewBounds="true"
            android:contentDescription="@string/hello_world"
            android:src="@drawable/loading_top" />

        <ImageView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom|center_horizontal"
            android:adjustViewBounds="true"
            android:contentDescription="@string/hello_world"
            android:src="@drawable/loading_bottom" />

        <ImageView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:contentDescription="@string/hello_world"
            android:background="@color/white"
            android:layout_marginBottom="5dp"
            android:paddingTop="10dp"
            android:paddingBottom="10dp"
            android:src="@drawable/loading_logo" />

        <ImageView
            android:id="@+id/loading"
            android:layout_width="fill_parent"
            android:layout_height="match_parent"
            android:layout_gravity="center|center_vertical"
            android:layout_marginBottom="0dp"
            android:layout_marginTop="0dp"
            android:contentDescription="@string/hello_world"
            android:scaleType="fitXY"
            android:src="@null" />
    </FrameLayout>
</LinearLayout>

我在第一个LinearLayout的第一行得到错误。

有人知道如何解决这个错误吗?

谢谢

更新:用什么为我解决了问题回答了我的问题

EN

回答 26

Stack Overflow用户

回答已采纳

发布于 2020-11-12 04:28:06

我已经使用Windows资源管理器复制了文件夹中的xml文件。这似乎导致了编码问题。删除文件并在Android Studio中复制后,问题就解决了。

票数 2
EN

Stack Overflow用户

发布于 2018-10-12 20:40:53

在我的案例中,关闭并重新打开安卓工作室解决了这个问题。重建项目或清除缓存都无济于事。

票数 205
EN

Stack Overflow用户

发布于 2018-10-10 14:38:51

您还可以尝试执行以下操作:

文件和缓存无效/重新启动=>无效和重新启动。

票数 70
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52547657

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档