布局< layout>版式中的布局在基本版式文件夹中没有声明[错误] [英] The layout <layout> in layout has no declaration in the base layout folder [error]

查看:212
本文介绍了布局< layout>版式中的布局在基本版式文件夹中没有声明[错误]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从Eclipse迁移到新版本的Android Studio 3.2,API 28之后,我的应用布局出现以下错误:

After migrating from Eclipse to the new version of Android Studio 3.2, API 28, I am getting the following error on my app's layout:

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

The layout in layout has no declaration in the base layout folder; this can lead to crashes when the resource is queried in a configuration that does not match this qualifier

我收到此错误的布局之一是:

One of the layouts that I am getting this error is:

<?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的第一行出现错误.

I get the error on the first line of the first LinearLayout.

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

Does anyone know how to solve this error?

谢谢

更新: 这似乎是一个编码问题.我已经使用Windows资源管理器将xml文件复制到了该文件夹中.删除文件并在Android Studio中处理它们后,问题已解决.

UPDATE: It seems to a be an encoding issue. I had copied the xml files in the folder using Windows Explorer. After deleting the files and coping them inside Android Studio, the problem has been solved.

推荐答案

就我而言,关闭并重新打开Android Studio 解决了该问题.重建项目或清除缓存无济于事.

In my case closing and reopening Android studio solved the problem. Rebuilding the project or clearing the cache didn't help.

这篇关于布局&lt; layout&gt;版式中的布局在基本版式文件夹中没有声明[错误]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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