Nach der Migration zu Android Studio 3.2, API 28, erhalte ich den folgenden Fehler im Layout meiner App:
Das Layout im Layout hat keine Deklaration im Basislayoutordner; dies kann zu Abstürzen führen, wenn die Ressource in einer Konfiguration abgefragt wird, die nicht mit diesem Qualifizierer übereinstimmt
Eines der Layouts, bei denen ich diesen Fehler bekomme, ist:
<?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>
Ich bekomme den Fehler in der ersten Zeile des ersten LinearLayout.
Weiß jemand, wie man diesen Fehler beheben kann?
Vielen Dank
UPDATE: Beantwortet meine Frage mit dem, was das Problem für mich gelöst hat
@L Kemp zeig mir einmal deinen Logcat
– Vijaya Varma Lanke
28. September 2018 um 5:25 Uhr
@Varma tatsächlich läuft die App ohne Fehler. Ich kann den Fehler nur sehen, sobald ich die XML-Datei öffne, aber das Layout dieser XML-Datei wird normal ausgeführt
– L Kemp
28. September 2018 um 5:39 Uhr
fill_parent ist seit API 8 veraltet und wurde durch match_parent ersetzt ViewGroup.LayoutParams
– Mahdi Javaheri
6. Oktober 2018 um 14:14 Uhr
@MahdiJavaheri Vielen Dank für Ihren Rat, aber das habe ich bereits gewusst, ich entferne diesen veralteten Code nach und nach.
– L Kemp
9. Oktober 2018 um 1:19 Uhr
In meinem Fall war es ein Problem im Zusammenhang mit dem Dateinamen. Sie können dies auch überprüfen, indem Sie Ihre Datei in Kapitälchen umbenennen
– Akash Kumar
29. März 2020 um 12:23 Uhr