Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialArturo Castro
1,711 PointsI got an error in the xml file, it says: Element android.support.constraint.ConstraintLayout is not allowed here
After I copied and pasted the instructions on Android Studio I got an error that says: Element android.support.constraint.ConstraintLayout is not allowed here. Im using Android Studio 3.6 and cant find a solution on the internet.
2 Answers
Xander Sheppard
3,516 Pointscan I see your code?
Xander Sheppard
3,516 Pointshere is my code. I used the androidx support package to get mines to work
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/coordinatorLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/appBackground">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/hourlyListItems"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="1.0" />
</androidx.constraintlayout.widget.ConstraintLayout>
Arturo Castro
1,711 PointsArturo Castro
1,711 PointsThanks Xander for the Reply. This is my code: https://ibb.co/MpvMkzv
Arturo Castro
1,711 PointsArturo Castro
1,711 PointsAnd this is the full code:
<?xml version="1.0" encoding="utf-8"?> <layout 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"> <data> <variable name="hour" type="com.example.stormy.weather.Hour"/> </data> <android.support.constraint.ConstraintLayout android:id="@+id/coordinatorLayout" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/appBackground" tools:context=".ui.HourlyForecastActivity">
</layout>