在Android studio中写xml布局文件都是会有提示的子
在我加入了 databinding 后突然就不能提示了
原来是因为 一个xml 里 只能有一个起作用
xmlns:app="schemas.android.com/apk/res-aut…" 这是因为我的xml里定义了两个 xmlns:app ,xmlns:binding的原因 而我的xml里因为 xmlns:binding是写在前面所以 只有 binding关键字起作用 而app是不提示的 如下图
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:binding="http://schemas.android.com/apk/res-auto"
xmlns:app="http://schemas.android.com/apk/res-auto">
而我一直用app 作为关键字,所以会出现不能提示的问题
关于 xmlns:xxxx="schemas.android.com/apk/res-aut…" 中 其中 xxxx 是可以自己随便设置的 而后面的链接是固定的。
如果不是出现以上问题 还可以:Invalidate Caches / Restart... 点击 Invalidate and Restart 重启一下