属性 insetForeground 已经被定义

attribute insetForeground has already be defined

更新到新版本后

com.android.support:design:22.2.0

我收到这个错误:

"attribute insetForeground has already be defined"

请记住我使用的是@romannurik ScrimInsetsFrameLayout.java

只是改变

insetForeground attribute

在您的 attrs.xml 中更改为其他名称

为了详细说明 Omar 的回答,

Android 设计支持库引入了 NavigationDrawer,它与 DrawerLayout 一起使用以提供实现导航等的方法。请参阅此处:

Android Design Support Library

NavigationDrawer 扩展了引入库的 ScrimInsetsFrameLayout。

题中的错误是因为定义了两次insetForeground属性。 一次是库的上下文,一次是将 ScrimInsetsFrameLayout 的副本引入项目时。

选项:

  1. 重命名项目中定义的 属性(按照 Omar 的建议) 同时继续使用 ScrimInsetsFrameLayout 的本地副本。
  2. 删除 ScrimInsetsFrameLayout 的本地副本并使用 取而代之的是图书馆。
  3. 删除 ScrimInsetsFrameLayout 的本地副本并使用 NavigationDrawer 代替。

您的文件中有此 class ScrimInsetsFrameLayout.java 而 Google 已将其放入 Google Android 支持设计库中。将 ScrimInsetsFrameLayout 替换为 android.support.design.widget.NavigationView

或者您可以将 values/attr.xml 中的 insetForeground 重命名为 insetForeground2 或其他东西