1You need to set layout manager
2Kotlin:
3val linearLayoutManager:LinearLayoutManager = LinearLayoutManager(this)
4linearLayoutManager.orientation = LinearLayoutManager.HORIZONTAL{or VERTICAL}
5recycleView.layoutManager = linearLayoutManager
6Java:
7LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
8linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL{or VERTICAL});
9list.setLayoutManager(linearLayoutManager);
1 <androidx.recyclerview.widget.RecyclerView
2 android:id="@+id/reccylerview"
3 android:layout_width="0dp"
4 android:layout_height="0dp"
5 android:layout_marginTop="8dp"
6 android:scrollbars="vertical"
7 app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"/>