Guys I have a simple recyclerview
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="1">
<android.support.v7.widget.RecyclerView
android:id="@+id/realm_recycler_view"
android:background="@null"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</RelativeLayout>
But it is not displaying as it should. I am expecting it to show like a normal list view ( height wise ) but somehow it takes the whole screen per recyclerview item. ( so its as big as the screen )
I have tried both wrap_content and match_parent without success..
Any suggestions on how to solve this?
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_main_activity_fragment_two, container, false);
recyclerView = (RecyclerView) rootView.findViewById(R.id.realm_recycler_view);
setupRecyclerView();
return rootView;
}
public void setupRecyclerView() {
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
recyclerView.setAdapter(new gradeRealmAdapter(this, realm.where(Grade.class).findAllAsync()));
recyclerView.setHasFixedSize(true);
recyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL_LIST));
recyclerView.setNestedScrollingEnabled(false);
}
You haven't shown us the layout of list element. It looks like you have match_parent
in your element layout height. Please, post also your RecyclerView item layout.