John Deere
John Deere

Reputation: 29

Android Studio layout_behavior error

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

enter image description here

Upvotes: 4

Views: 9521

Answers (3)

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

Upvotes: 1

Jeisson Valderrama
Jeisson Valderrama

Reputation: 109

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"

Upvotes: 2

Volodymyr
Volodymyr

Reputation: 6579

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.

Upvotes: 0

Related Questions