简体   繁体   English

Android Studio layout_behavior 错误

[英]Android Studio layout_behavior error

Any advice why I'm getting this error on layout_behavior, and how to fix it?有什么建议为什么我在 layout_behavior 上遇到这个错误,以及如何解决它?

在此处输入图片说明

It is possible that you have a different label than this: android.support.design.widget.CoordinatorLayout您可能有与此不同的标签: android.support.design.widget.CoordinatorLayout

maybe you have android.support.constraint.ConstraintLayout .也许你有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"如果是这样,您应该将其更改为android.support.design.widget.CoordinatorLayout ,因为子元素可以应用属性app:layout_behavior="@string/appbar_scrolling_view_behavior"

For Androidx I followed this and got problem solved.对于 Androidx,我遵循了这个并解决了问题。

summary: In Gradle:摘要:在 Gradle 中:

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

in XML:在 XML 中:

app:layout_behavior="@string/appbar_scrolling_view_behavior"

If not solved then Invalidate caches / Restart如果未解决,则使缓存无效/重新启动

layout_behavior attribute is part of the CoordinatorLayout . layout_behavior属性是CoordinatorLayout一部分。 It defines interaction behavior plugin for child views of CoordinatorLayout.它为 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.在您的情况下,您可以从代码中删除此属性( app:layout_behavior="@string/appbar_scrolling_view_behavior" ),或者如果您需要行为功能,则使用CoordinatorLayout包装您的RelativeLayout

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Android Studio错误:在软件包“ com.example.parthp.myapplication”中找不到属性“ layout_behavior”的资源标识符 - Android Studio Error : No resource identifier found for attribute 'layout_behavior' in package 'com.example.parthp.myapplication' Android NestedScrollView 在 app:layout_behavior 后尺寸错误 - Android NestedScrollView has wrong size after app:layout_behavior 如何打包我的 Android 库,以便我的客户不会遇到诸如“AAPT:错误:属性 layout_behavior”之类的错误 - How can I package my Android library so that my customer does not experience errors like "AAPT: error: attribute layout_behavior" 以编程方式设置 app:layout_behavior - Setting app:layout_behavior programmatically 'app:layout_behavior' 应该在哪里设置? - Where should 'app:layout_behavior' be set? 还有其他app:layout_behavior预定义值吗? - Are there other app:layout_behavior predefined values? Layout_behavior在另一个适配器内部 - Layout_behavior with an Adapter inside another one 在工具栏应用程序中永远不会调用自定义滚动行为:layout_behavior - custom scroll behavior is never called in toolbar app:layout_behavior 如何以编程方式打开和关闭layout_behavior行为? - How to toggle layout_behavior behavior on and off programmatically? 在包中找不到属性“layout_behavior”的资源标识符 - No resource identifier found for attribute 'layout_behavior' in package
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM