首页 > 解决方案 > RecyclerView 未显示在 Android Studio 预览版中

问题描述

这就是我在布局中添加 recyclerView 时得到的结果。(我已经导入了依赖项)

我的布局:

    <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
    android:layout_height="match_parent">


    <androidx.recyclerview.widget.RecyclerView
        android:layout_width="match_parent"
        android:layout_height="match_parent" />


</RelativeLayout>

布局中的 RecyclerView

这是我设置高度和宽度来包装内容的时候:

在此处输入图像描述

在这里,我看不到像这样的常规回收站视图:

在此处输入图像描述

那么,如何在 Android Studio 上重新获得这个视图呢?

迄今为止尝试的解决方案;

1.使缓存无效

2.删除Android Studio 4.0目录下的Caches文件夹

标签: androidlayoutandroid-recyclerview

解决方案


Build > Clean Project解决了这个问题。


推荐阅读