开发者社区 问答 正文

使用Recyclerview时报这个错误

/RecyclerView: No adapter attached; skipping layout
刚用Recyclerview,很多东西都不懂!
下面为代码片段:
screenshot

展开
收起
爵霸 2016-03-16 11:47:03 2049 分享 版权
1 条回答
写回答
取消 提交回答
  •  void dispatchLayout() {
            if (mAdapter == null) {
                Log.e(TAG, "No adapter attached; skipping layout");
                return;
            }
            if (mLayout == null) {
                Log.e(TAG, "No layout manager attached; skipping layout");
                return;
            }
                    .....
    
            }

    adapter为空时报这个错误。

    2019-07-17 19:03:46
    赞同 展开评论
问答地址: