2

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?

Kaiser
  • 606
  • 8
  • 22

3 Answers3

4
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.

enter image description here

CoolMind
  • 26,736
  • 15
  • 188
  • 224
  • no it is still giving me the suggestion as "androidx.appcompat.app.AlertController$RecycleListView" ..got any other solution? –  Nov 11 '19 at 09:05
  • @IRONMAN, please, show your `build.gradle` and an error. – CoolMind Nov 11 '19 at 09:06
  • see..I'm not getting error ok...I have added your your dependencies in my Gradle but its not giving me the proper suggestion for recycle view in xml...it gives me something like "androidx.appcompat.app.AlertController$RecycleListView" –  Nov 11 '19 at 09:09
  • @IRONMAN, I added a picture. – CoolMind Nov 11 '19 at 09:15
  • 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. – Parth Lotia Nov 11 '19 at 09:44
  • I got it...all I did is restart my project...thanks –  Nov 11 '19 at 09:52
  • 1
    Thank you for acceptance of the anser, friend @AshwiniJ. – CoolMind Nov 15 '19 at 08:13
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.

enter image description here

CoolMind
  • 26,736
  • 15
  • 188
  • 224
Parth Lotia
  • 753
  • 1
  • 7
  • 25
0
 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" />
MEGHA DOBARIYA
  • 1,622
  • 9
  • 7