简体   繁体   English

ViewBinding 的 Master/Detail Flow 问题

[英]Master/Detail Flow problems with ViewBinding

I was creating an app for some tests, so when Android Studio asks you to select a project template, I choose Master/Detail Flow, at first it starts and executes very well, so I continue to add some Gradle configs I use, one of them is the android.buildFeatures.viewBinding true after synchronized the Gradle, when I try to rebuild the app it fails.我正在为一些测试创建一个应用程序,所以当 Android Studio 要求你给 select 一个项目模板时,我选择 Master/Detail Flow,一开始它启动并执行得很好,所以我继续添加一些 Z7B5CC4FB56E11DC7520F716 的配置 IBBEC 使用,它们是android.buildFeatures.viewBinding true在同步 Gradle 后为真,当我尝试重建应用程序时它失败了。 This is the error that I get:这是我得到的错误:

Configurations for item_list.xml must agree on the root element's ID.
Missing ID:
- layout-w900dp
@+id/item_list:
- layout

So I tried to fix it but I didn't find anything on the internet, I clean the project, rebuild it, creating a new one without any modification just that one mentioned before, but none of that worked.所以我试图修复它,但我在互联网上没有找到任何东西,我清理了项目,重建它,创建了一个新的项目,没有任何修改,只是前面提到的那个,但没有一个奏效。 I noticed there are two files of that file: picture of the two files我注意到该文件有两个文件:两个文件的图片

These files are created by default, I think that having two files is causing the issue but I just want to know if anyone had resolved this problem before or what solution could you give?这些文件是默认创建的,我认为有两个文件会导致问题,但我只想知道是否有人以前解决过这个问题,或者你能给出什么解决方案?

I appreciate any help.我很感激任何帮助。

Thanks, GiusNiyyel.谢谢,朱斯尼耶。

This error comes because the template generates two layouts with different root views (linear layout and recyclerview) for the list.xml, and list.xml (w900dp)出现此错误是因为模板为 list.xml 和 list.xml (w900dp) 生成了两个具有不同根视图(线性布局和回收视图)的布局

wrap the recyclerview with a LinearLayout and you are good to go用 LinearLayout 包装 recyclerview,你对 go 很好

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

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