问题
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:
- Rename the property defined in the project (as suggested by Omar) while continuing using the local copy of ScrimInsetsFrameLayout.
- Remove the local copy of ScrimInsetsFrameLayout and use the one in the library instead.
- 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