小编L K*_*emp的帖子

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

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

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

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

<?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>
Run Code Online (Sandbox Code Playgroud)

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

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

谢谢

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

xml android android-studio

61
推荐指数
12
解决办法
3万
查看次数

标签 统计

android ×1

android-studio ×1

xml ×1