How to use RecyclerView RecyclerView in?

Actually the question is how to use RecyclerView RecyclerView in, because in my approach, the elements instead of being loaded in each list item are displayed in a single element. and the next empty.

public class CategoryRecyclerAdapter extends RecyclerView.Adapter<categoryrecycleradapter.categoryviewholder> {
 private List<categoryreference> categoryReferences;
 private Context Context;


 public CategoryRecyclerAdapter(List<categoryreference> categoryReferences, Context Context) {
 this.categoryReferences = categoryReferences;
 this.context = context;
}

@Override
 public CategoryViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
 View View = LayoutInflater.from(parent.getContext()).inflate(R. layout.item_recycler_reference, parent, false);
 CategoryViewHolder categoryViewHolder = new CategoryViewHolder(view);
 return categoryViewHolder;
}

@Override
 public void onBindViewHolder(CategoryViewHolder holder, int position) {
holder.categoryName.setText(categoryReferences.get(position).getCategoryName());
 HorizontalLayoutManager LinearLayoutManager = new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false);
holder.recycleItemReference.setLayoutManager(horizontalLayoutManager);
 holder.recycleItemReference.setAdapter(new ReferenceRecyclerAdapter(categoryReferences.get(position).getReferencesList()));

}

@Override
 public int getItemCount() {
 return categoryReferences.size();
}

 public static class CategoryViewHolder extends RecyclerView.ViewHolder{
 TextView categoryName;
 RecyclerView recycleItemReference;
 public CategoryViewHolder(View itemView) {

super(itemView);
 categoryName = itemView.findViewById(R. id.tv_category_name);
 recycleItemReference = itemView.findViewById(R. id.reference_pager);

}
}
}</categoryreference></categoryreference></categoryrecycleradapter.categoryviewholder>
June 8th 19 at 17:07

Find more questions by tags AndroidJava