未知属性android:layout_width、layout_height、id、gravity、layout_gra


  • 在所有android标签上获取未知属性错误
  • 在布局XML中,自动建议没有显示所有属性(如CCD_ 1,layout_heightorientation,方位&所有其他android属性。(

这里我为解决这个问题所做的事情:

  • 清洁构建&重建
  • 删除。想法
  • 文件无效缓存/重新启动
  • 选项打开节能模式

SDk是最新的。

我的xml布局:

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
tools:context=".MainActivity"
xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_height="match_parent"
android:layout_width="match_parent">
<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>

我和你们一样遇到了同样的问题,我做了你们做过的所有事情,下面是我的解决方案。也许问题出在你的目标SDK版本。如果是28.0.0,您可以将其更改为27.1.1,并将项目与gradle文件同步。

这可以帮助你解决问题。

更改应用程序模块build.gradle文件中的某些内容,例如,注释一行,然后单击File,然后单击Sync Project with Gradle Files

最新更新