Home > Software design >  androidMainfest.xml file error in android studio
androidMainfest.xml file error in android studio

Time:10-05

enter code here"Element androidx.appcompat.widget.LinearLayoutCompat must be declared" this error is shown when I run the xml file in android studio. there is no suggestions to change the code.

enter code here
    <?xml version="1.0" encoding="utf-8"?>
    <androidx.appcompat.widget.LinearLayoutCompat 
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="16dp"
android:orientation="vertical"
tools:context=".MainActivity">
<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="QUANTITY"
    android:padding_top="16dp"
    android:padding_bottom="16dp"/>
<TextView
    android:id="@ id/quantity_text-view"
    android:layout_width="wrap_content"
    android:layuout_height="wrap_content"
    android:textColor="@color/black"
    android:text="0"
    android:textSize="16sp"/>
<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="PRICE"
    android:paddingTop="16dp"
    android:paddingBottom="16dp"/>
<TextView
    android:id="@ id/price_text_view"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="0"
    android:textColor="@color/black"
    android:textSize="16sp" />
<Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:padding="3dp"
    android:layout_marginTop="16dp"
    android:text="ORDER"
    android:onClick="submitOrder"/>

</androidx.appcompat.widget.LinearLayoutCompat>

CodePudding user response:

Probably you placed your layout xml files in the wrong directory.
The right folder is res/layout.
Check enter image description here

  • Related