How to fix the error "Attribute android: layout_width is not allowed here"?

1

Please help me !, and sorry for the errors in my publication, I am new to this. The errors that appear are the following: * Android Attribute: layout_width is not allowed here * Android Attribute: layout_height is not allowed here * Attribute tools: context is not allowed here * Element TextView is not allowed here

The code is this:

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.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="com.example.admin.lala.MainActivity">

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Hello World!"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

Please help me !, and thank you in advance! :)

    
asked by Liz 18.03.2018 в 03:09
source

1 answer

0

In my case I solved it changing in the build.gradle

"compileSdkVersion 27" ... and "targetSdkVersion 27"

for

"compileSdkVersion 28" ... and "targetSdkVersion 28"

and synchronizing, recognizes android again: "foo"

(but you will have to update the versions of the dependencies that you are using and will be left behind.)

    
answered by 14.10.2018 в 00:42