attribute insetForeground has already be defined

大城市里の小女人 提交于 2019-12-04 16:03:42

问题


after updating to the new

com.android.support:design:22.2.0

I got this error:

"attribute insetForeground has already be defined"

keep in mind that i'm using @romannurik ScrimInsetsFrameLayout.java


回答1:


just change

insetForeground attribute

in your attrs.xml to a different name




回答2:


To elaborate on Omar's answer,

The Android design support library introduced NavigationDrawer that is used together with DrawerLayout to provide means of implementing navigation etc. See here:

Android Design Support Library

The NavigationDrawer extends ScrimInsetsFrameLayout which was brought into the library.

The error in the question occurs because the insetForeground attribute was defined twice. Once is the context of the library and once when a copy of ScrimInsetsFrameLayout was brought into the project.

Options:

  1. Rename the property defined in the project (as suggested by Omar) while continuing using the local copy of ScrimInsetsFrameLayout.
  2. Remove the local copy of ScrimInsetsFrameLayout and use the one in the library instead.
  3. Remove the local copy of ScrimInsetsFrameLayout and use NavigationDrawer instead.



回答3:


You have this class ScrimInsetsFrameLayout.java in your files whereas Google already put this in the Google Android Support Design Library. Replace the ScrimInsetsFrameLayout into android.support.design.widget.NavigationView




回答4:


Or else you can rename insetForeground in your values/attr.xml to insetForeground2 or something



来源:https://stackoverflow.com/questions/30555820/attribute-insetforeground-has-already-be-defined

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!