So I\'ve been taking a shot at the Material Design of Android Preview L. I imported both the CardView
and the RecyclerView
libraries.
I use the
If some one is facing the same issue for Recycler view inside fragment 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_timeline, container, false);
mRecyclerView = (RecyclerView) rootView.findViewById(R.id.my_recycler_view);
// use this setting to improve performance if you know that changes
// in content do not change the layout size of the RecyclerView
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;
}