Reputation:
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?
Upvotes: 2
Views: 8925
Reputation: 1927
1.Open build.gradle and add recycler view dependency.
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
2. left corner of this file sync now option and click on it.
3. in xml file you can add below code:
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/listing"
android:layout_width="match_parent"
android:layout_height="match_parent" />
Upvotes: 0
Reputation: 803
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.
Upvotes: 2
Reputation: 28835
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.
Upvotes: 4