问题
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 seeRecyclerView
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