支持库中的RecyclerView在哪里?

编程入门 行业动态 更新时间:2024-10-25 02:21:21
本文介绍了支持库中的RecyclerView在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在开发一个使用RecyclerView组件的应用程序.我正在检查build.gradle文件,它具有以下依赖性:

I'm working on an app which uses the RecyclerView component. I was checking my build.gradle file and it had these dependencies:

compile 'com.android.support:appcompat-v7:25.3.1' compile 'com.android.support:cardview-v7:25.3.1' compile 'com.android.support.constraint:constraint-layout:1.0.0-beta5' compile 'com.android.support:design:25.3.1' testCompile 'junit:junit:4.12' compile 'com.android.support:support-v4:25.3.1'

没有'com.android.support:recyclerview-v7:25.3.1',但是我在项目中有一个RecyclerView(android.support.v7.widget.RecyclerView).

There was no 'com.android.support:recyclerview-v7:25.3.1', and yet I had a RecyclerView (android.support.v7.widget.RecyclerView) in the project.

上面的哪些软件包还包含RecyclerView?还是我对支持库软件包不了解?

Which of the packages above also contains the RecyclerView? Or is there something I don't understand about the support library packages?

推荐答案

上面的哪些软件包还包含RecyclerView?

Which of the packages above also contains the RecyclerView?

没有一个. RecyclerView 位于 recyclerview-v7 中.

或者我对支持库软件包不了解吗?

Or is there something I don't understand about the support library packages?

design 对 recyclerview-v7 具有传递依赖.因此,取决于 design ,您的应用还取决于 recyclerview-v7 .这会自动为您处理.

design has a transitive dependency upon recyclerview-v7. Hence, by depending upon design, your app also depends upon recyclerview-v7. This is handled for you automatically.

您可以进一步简化依赖关系,因为 design 取决于 appcompat-v7 ,因此您无需自己请求 appcompat-v7 :

You could simplify your dependencies further, as design depends upon appcompat-v7, so you do not need to request appcompat-v7 yourself:

// compile 'com.android.support:appcompat-v7:25.3.1' compile 'com.android.support:cardview-v7:25.3.1' compile 'com.android.support.constraint:constraint-layout:1.0.0-beta5' compile 'com.android.support:design:25.3.1' testCompile 'junit:junit:4.12' compile 'com.android.support:support-v4:25.3.1'

然后,注释掉 support-v4 依赖项,看看是否存在构建问题.很有可能,您从那里使用的东西已经被其他东西引入了,因此您在 build.gradle 文件中也不需要该依赖项.

Then, comment out the support-v4 dependency and see if you have build problems. Most likely, what you are using from there is pulled in by something else already, and so you will not need that dependency in your build.gradle file either.

您可以在此处.

更多推荐

支持库中的RecyclerView在哪里?

本文发布于:2023-07-14 21:44:02,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1107224.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:库中   RecyclerView

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!