I have a CardView with one ImageView and three TextView , however they do not appear when the application starts. How to add the code correctly to make it work? Here is the fragment code where CardView should be
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { RecyclerView recyclerView = (RecyclerView) inflater.inflate( R.layout.recycler_view, container, false); ContentAdapter adapter = new ContentAdapter(recyclerView.getContext()); recyclerView.setAdapter(adapter); recyclerView.setHasFixedSize(true); recyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); return recyclerView; } // toolbar @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setHasOptionsMenu(true); // This Fragment has a menu } @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater){ inflater.inflate(R.menu.menu_news, menu); // Inflate the Fragment's menu super.onCreateOptionsMenu(menu, inflater); } // recycler public static class ViewHolder extends RecyclerView.ViewHolder { CardView cv; TextView cvUser; TextView cvLocation; ImageView cvPhoto; TextView cvContent; public ViewHolder(LayoutInflater inflater, ViewGroup parent) { super(inflater.inflate(R.layout.card_feed, parent, false)); cv = (CardView) itemView.findViewById(R.id.card_view); cvUser = (TextView) itemView.findViewById(R.id.card_user); cvLocation = (TextView) itemView.findViewById(R.id.card_location); cvPhoto = (ImageView) itemView.findViewById(R.id.card_image); cvContent = (TextView) itemView.findViewById(R.id.card_text); } } public static class ContentAdapter extends RecyclerView.Adapter<ViewHolder> { // Установим количество элементов списка в RecyclerView. private static final int LENGTH = 18; public ContentAdapter(Context context) { } @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { return new ViewHolder(LayoutInflater.from(parent.getContext()), parent); } @Override public void onBindViewHolder(ViewHolder holder, int position) { // no-op } @Override public int getItemCount() { return LENGTH; } }