简体   繁体   中英

Android Studio layout_behavior error

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

在此处输入图片说明

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"

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

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 with CoordinatorLayout if you need behavior functionality.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM