I try to use RecyclerView with RecyclerView.Adapter but here is something wrong. I post my code below:
Layout:
If your are facing the same issue for RecycleView inside a fragment, try to use this code.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View rootView = inflater.inflate(R.layout.fragment_latest, container, false);
// get recycler view
mRecyclerView = (RecyclerView) rootView.findViewById(R.id.novel_item_list);
//mRecyclerView.setHasFixedSize(true);
// use a linear layout manager
mLayoutManager = new LinearLayoutManager(getActivity());
mRecyclerView.setLayoutManager(mLayoutManager);
String[] abc = {"hi","how are you","this is recycler"};
// specify an adapter (see also next example)
mAdapter = new RecyclerViewAdapter(abc);
mRecyclerView.setAdapter(mAdapter);
return rootView;
}