Search code examples
androidkotlinandroid-studioandroid-xml

I am trying to run an app android studio giraffe version, keep getting error in layout bolded line is my error


enter image description here

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <LinearLayout
        android:id="@+id/linearLayout"
        android:layout_width="1246dp"
        android:layout_height="783dp"
        android:gravity="bottom|center|end|top|start"
        android:orientation="horizontal"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <ImageView
        android:id="@+id/img_sail"
        android:layout_width="486dp"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:contentDescription="@string/img_sail"
        android:scaleType="fitStart"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintStart_toStartOf="@+id/constraintLayout"
        app:layout_constraintTop_toTopOf="parent"
        app:srcCompat="@drawable/img_sail" />

  **  <androidx.constraintlayout.widget.ConstraintLayout**
        android:id="@+id/constraintLayout"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_marginBottom="3dp"
        android:layout_weight="1"
        app:layout_constraintBottom_toTopOf="@+id/textView3"
        app:layout_constraintEnd_toStartOf="@+id/textView3"
        app:layout_constraintStart_toStartOf="@+id/textView3"
        app:layout_constraintTop_toTopOf="parent" />

    <TextView
        android:id="@+id/txtTitle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="50dp"
        android:text="@string/txt_title"
        android:textSize="48sp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.5"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <TextView
        android:id="@+id/txtDescription"
        android:layout_width="620dp"
        android:layout_height="427dp"
        android:layout_marginStart="24dp"
        android:layout_marginTop="50dp"
        android:lineSpacingExtra="8sp"
        android:text="@string/txt_description"
        android:textSize="34sp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/txtTitle" />

    <Button
        android:id="@+id/btnDate"
        android:layout_width="602dp"
        android:layout_height="121dp"
        android:layout_marginTop="40dp"
        android:text="@string/btn_date"
        android:textSize="34sp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.536"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/txtDescription" />

    <TextView
        android:id="@+id/textView3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="50dp"
        android:textSize="34sp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.5"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/constraintLayout" />

</androidx.constraintlayout.widget.ConstraintLayout>

I am very new with android studio, as in, my second week! Please explain this to me and guide me to a solution? I cannot run my tablet intended application! Again, I am novice and want to learn the solution. Thank you in advance for any help or suggestions that you may have!The app should look like this if it helps? I am willing to provide any other details that are needed to clarify the situation!


Solution

    • i have notice that tag androidx.constraintlayout.widget.ConstraintLayout not closed you should make end tag like </androidx.constraintlayout.widget.ConstraintLayout>

    • my advice to you that you should to learn just basic of android xml you will move through these problems