玄学之坑:RecyclerView: No adapter attached; skipping layout
2017-03-18 12:45
405 查看
这个坑真的是玄学,报错信息显示rv没有绑定适配器,也就无法显示。不管怎么调试都没用:
这个rv是在fragment里的,最终确定问题发生在基类fragemnt中。
原来我的基类代码是这样:@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
init(inflater.inflate(getResourseId(),null));
return inflater.inflate(getResourseId(),null);
}其中的getResourceID是抽象方法,返回布局Id。
通过调试发现init方法在子类中没有调用
当我把代码换成:@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view=inflater.inflate(getResourseId(),null);
init(view);
return view;
}init就调用了,而且问题得到解决。可以发现两段代码其实相同,为什么效果完全不同嘞????
这个rv是在fragment里的,最终确定问题发生在基类fragemnt中。
原来我的基类代码是这样:@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
init(inflater.inflate(getResourseId(),null));
return inflater.inflate(getResourseId(),null);
}其中的getResourceID是抽象方法,返回布局Id。
通过调试发现init方法在子类中没有调用
当我把代码换成:@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view=inflater.inflate(getResourseId(),null);
init(view);
return view;
}init就调用了,而且问题得到解决。可以发现两段代码其实相同,为什么效果完全不同嘞????
相关文章推荐
- RecyclerView: No adapter attached; skipping layout
- 关于RecyclerView: No adapter attached; skipping layout
- 使用Recyclerview 遇到No adapter attached; skipping layout 问题
- E/RecyclerView: No adapter attached; skipping layout
- RecyclerView: No adapter attached; skipping layout
- E/RecyclerView: No adapter attached; skipping layout
- recyclerview No adapter attached; skipping layout
- 使用RecyclerView加载网络图片时出现no adapter attached skipping layout
- RecylerView:no adapter attached;skipping layout
- 使用RecyclerView时出现:RecyclerView: No adapter attached; skipping layout
- RecyclerView 提示No adapter attached; skipping layout 解决方法
- android E/RecyclerView﹕ No adapter attached; skipping layout
- No layout manager attached; skipping layout
- Android之RecyclerView的原生Bug-Inconsistency detected. Invalid view holder adapter positionViewHolder{a1bbfa3 position=2 id=-1, oldPos=-1, pLpos:-1 no parent}
- android开发 RecycleView之No adapter attached; skipping layout
- RecyclerView has no LayoutManager
- 错误LinearLayoutManager is already attached to a RecyclerView
- SwipeRefreshLayout、RecyclerView、BaseRecyclerViewAdapterHelper 三者组合的刷新加载View
- RecyclerView ViewHolder getAdapterPotition return NO_POSITION!
- RecyclerView的各种LayoutManager、Adapter模版(仅下拉刷新、点击、长按)