属性是不允许的

时间:2019-02-02 18:27:58

标签: android

我最近启动了android studio 3.2,当我创建一个新项目时,它无法同步,并给出错误,即序言中不允许包含内容,并且该错误存在于xml文件中,在该文件中出现错误,表明不允许使用android布局属性。我尝试了这里提供的许多解决方案,但没有锻炼。

   <?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=".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" />

</android.support.constraint.ConstraintLayout>

1 个答案:

答案 0 :(得分:1)

对该问题稍有困惑,但是我遇到了一个问题,即我无法在.xml文件中输入任何内容,因此我在gradle.build (Module:app)中更新了目标SDK,并且可以正常工作。

编辑:SDK版本为28-Android Studio建议使用此版本,以避免出现“兼容性问题”。

相关问题