【问题标题】:Recyclerview no adapter attached skipping layout Android [duplicate]Recyclerview没有附加适配器跳过布局Android [重复]
【发布时间】:2018-04-04 21:11:07
【问题描述】:

这是我的适配器代码。让我知道是否需要完整的适配器代码或更多代码 sn-p

public class PostAdapter extends RecyclerView.Adapter<PostAdapter.PostViewHolder>{

    private Context context;

    public PostAdapter(Context context, List<Item> items) {
        this.context = context;
        this.items = items;
    }

【问题讨论】:

标签: java android android-recyclerview


【解决方案1】:

您收到该警告是因为您尚未为回收站视图设置适配器。

PostAdapter adapter = new PostAdapter(getContext(),mItems);
mRecyclerView.setAdapter(adapter);

确保您的回收站视图也有一个布局管理器

mRecylerView.setLayoutManager(new LinearLayoutManager(getContext());

【讨论】:

    猜你喜欢
    • 2019-01-02
    • 2020-05-01
    • 2015-09-01
    • 2015-10-24
    • 1970-01-01
    • 2017-12-01
    • 1970-01-01
    • 2015-08-29
    • 1970-01-01
    相关资源
    最近更新 更多