步骤如下:
1、在/app下的build.gradle中的dependencies中添加以下语句:
implementation 'androidx.legacy:legacy-support-v4:1.0.0+'
2、在需要用到RecyclerView的活动对应的xml布局文件中,加入下列语句
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"/>