4

Any advice why I'm getting this error on layout_behavior, and how to fix it?

enter image description here

Ricardo Faria
  • 764
  • 13
  • 30
John Deere
  • 29
  • 1
  • 4

3 Answers3

2

It is possible that you have a different label than this: android.support.design.widget.CoordinatorLayout

maybe you have android.support.constraint.ConstraintLayout.

If so, you should change it to android.support.design.widget.CoordinatorLayout, since the child elements can apply the attribute app:layout_behavior="@string/appbar_scrolling_view_behavior"

1

For Androidx I followed this and got problem solved.

summary: In Gradle:

implementation 'com.google.android.material:material:1.1.0-alpha05'

in XML:

app:layout_behavior="@string/appbar_scrolling_view_behavior"

If not solved then Invalidate caches / Restart

0

layout_behavior attribute is part of the CoordinatorLayout. It defines interaction behavior plugin for child views of CoordinatorLayout.

In your case you can either delete this attribute (app:layout_behavior="@string/appbar_scrolling_view_behavior") from your code or wrap your RelativeLayout withCoordinatorLayout if you need behavior functionality.

Volodymyr
  • 6,393
  • 4
  • 53
  • 84