在包 'android.support.design' 中找不到属性 'layoutManager' 的资源标识符

No resource identifier found for attribute 'layoutManager' in package 'android.support.design'

我在我的项目中添加了 'android.support.design' 库作为依赖项

但是发现如下错误。

No resource identifier found for attribute 'layoutManager' in package 'android.support.design'

到目前为止我做了什么..

  1. 更新到最新的支持库版本
  2. 添加 appcompat 作为其依赖项("design library")
  3. 检查 "design library" 作为库模块

请帮忙。

要使用 android.support.design 添加此作为 gradle 依赖项:

compile 'com.android.support:design:22.2.1'

你很高兴去....

设计库依赖于 appcompat-v7 库,正如 . But (at least in rev. 23.1) it depends on v7-recyclerview 库中指出的那样。

所以基本上你有两个选择:

  1. Link v7-recyclerview 库到您的设计支持库项目中(与您 link appcompat-v7 库的方式相同)
  2. 或者您可以通过删除行 app:layoutManager="android.support.v7.widget.LinearLayoutManager" 来摆脱依赖 ..design\res\layout\design_navigation_menu.xml 文件。 (如果您没有使用设计库中的 NavigationMenu,或者希望稍后解决此问题)

感谢您在文档中阐明这一点 Google!