Skip to content
Advertisement

Why is my recyclerview greyed out? Anyone?

This is an image of my XML layout

Am using the right dependencies and as you can see my xml is properly arranged, someone hep out

Advertisement

Answer

That can happen due to various reasons

1. Dependency issue: Check your app’s build.gradle if you have one of the dependencies. if not, add them and rebuild the project.

If your project is in appcompat: implementation ‘com.android.support:recyclerview-v7:28.0.0’

If your project is in androidX: implementation “androidx.recyclerview:recyclerview:1.1.0”

2. Wrong dependency: If the above is correct, you need to check if your project is in appcompat or not, if yes, you will need to replace the recyclerview in xml file with below code:

<android.support.v7.widget.RecyclerView
    android:id="@+id/home_recyclerview"
    android:scrollbars="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"/>
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement