RecyclerView dependencies in android(androidx)?

我的梦境 提交于 2020-01-24 20:18:28

问题


I used implementation 'com.google.android.material:material:1.0.0' for RecycleView. In layout when I'm typing "recycle" it gives suggestion as androidx.appcompat.app.AlertController$RecycleListView which is not what I want.

Even though I'm typing this androidx.recyclerview.widget.RecyclerView it works but it doesn't let used attributes like id, height, width, etc. inside. It was working fine one month ago like it was giving proper suggestion now it completely not showing for RecycleView. Does anyone has a solution?


回答1:


implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'

Update

Here is a list of some libraries in my build.gradle:

implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'

Also see Where is the RecyclerView in the support library? and How to import RecyclerView for Android L-preview.




回答2:


  • First of all remove your all dependency related to RecyclerView, then go to your XML and then switch to design. You will see RecyclerView with download arrow. Click on that arrow.

  • This will add a dependency according to your SDK version. No need to add particular version for that.This will do by itself.



来源:https://stackoverflow.com/questions/58798251/recyclerview-dependencies-in-androidandroidx

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!