android - 未知属性android:layout_width、layout_height、id、gravity、layout_gravity等xml中的属性
问题描述
- 在所有 android 标签上出现未知属性错误。
- 在布局 XML 中,自动建议未显示所有属性(如
layout_width
、layout_height
、orientation
、方向和所有其他 android 属性。)
这里我为解决这个问题所做的事情:
- 清洁构建和重建
- 删除 .idea
- 文件无效的缓存/重新启动..
- 选项打开省电模式。
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>
解决方案
我和你一样有同样的问题,我做了你做过的所有事情,这是我的解决方案。也许问题是你在 gradle 中的 targetSDKversion。如果是 28.0.0,您可以将其更改为 27.1.1 并将您的项目与 gradle 文件同步。
这可以帮助您解决它。
推荐阅读
- flutter - 保存 SharedPrefrence 变量
- encoding - 一系列相似灰度图像的无损压缩
- wordpress - string(2) "id" 注意:id 调用不正确。不应直接访问产品属性。回溯:
- reactjs - 用 SVG 线连接反应组件
- eslint - EsLint 说找不到规则“jsdoc/require-jsdoc”的定义?
- caching - 当来自服务器的响应为空列表时,Apollo Client refetch() 不会更新缓存
- vue.js - 如何在 vue 指令中将函数作为参数传递
- corda - 如何在corda中找到谁进行了否认国家攻击
- android-studio - 在我更新的 android studio 4.0.1 版中添加了一些依赖项后,
- php - PHPMailer + HTML2PDF:pdf无效和pj