【发布时间】:2019-03-03 23:57:39
【问题描述】:
迁移到 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>
我在第一个 LinearLayout 的第一行得到错误。
有谁知道如何解决这个错误?
谢谢
更新:用为我解决问题的方法回答了我的问题
【问题讨论】:
-
@L Kemp 曾经给我看你的 logcat
-
@Varma 实际上应用程序运行没有错误。我打开xml文件就可以看到错误,但是这个xml文件的布局运行正常
-
fill_parent 自 API 8 以来已弃用,并替换为 match_parent ViewGroup.LayoutParams
-
@MahdiJavaheri 谢谢你的建议,不过,我已经知道了,我正在一点一点地删除那些弃用的代码。
-
在我的情况下,这是与文件名有关的问题,您也可以通过将文件重命名为小型大写字母来检查
标签: android xml android-studio