Recycler view showing single item
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.
Introduction
When a RecyclerView shows only one row, the root cause is usually data, adapter contract, or layout constraints, not RecyclerView itself. Debugging becomes quick if you check item count, layout manager, and row dimensions in a fixed order. This guide gives a practical checklist and code patterns to resolve the issue reliably.
Confirm Data Size Before UI Debugging
Start by proving data actually contains multiple items right before adapter binding.
If size is one at this stage, the bug is upstream in repository or mapper logic.
Then verify adapter exposes the same count.
Ensure Layout Manager Is Set
RecyclerView requires a layout manager.
Missing layout manager can cause incomplete rendering or empty output depending on timing and state.
If you use grid layout, verify span settings are appropriate for item width.
Check Row Layout Height and Parent Constraints
One of the most common reasons for seeing only one visible item is row root using match_parent height in a vertical list.
Correct row root should usually be wrap_content.
Also inspect parent containers. A fixed-height parent or nested scrolling container may clip remaining rows.
Handle Updates Correctly
If the first row appears but later data never appears, update notifications are often missing.
With ListAdapter, always submit a new list instance.
Mutating a list in place can prevent DiffUtil from detecting changes.
Verify ViewHolder Binding Logic
Binding bugs can make rows look duplicated or blank, giving impression of one item.
Checklist:
- Bind all visible fields every time in
onBindViewHolder. - Do not rely on old view state from recycled holders.
- Avoid expensive async updates without stable position checks.
If rows seem to overwrite each other, inspect adapter position usage in click listeners and delayed callbacks.
Fast Debug Checklist
Use this sequence:
- Log source data size.
- Log adapter
getItemCount. - Confirm layout manager assignment.
- Inspect row root height and parent constraints.
- Verify adapter notification or
submitListcalls.
This flow isolates most issues within minutes.
Common Pitfalls
- Returning constant value from
getItemCountduring testing. Fix by returning backing list size. - Forgetting to set layout manager. Fix by assigning manager before or with adapter.
- Setting row root height to
match_parentin vertical list. Fix by usingwrap_content. - Updating data without notifying adapter or submitting new list instance. Fix by calling proper update APIs.
- Embedding RecyclerView inside constrained parent that clips content. Fix by reviewing parent layout and scroll strategy.
Summary
- Single-item RecyclerView issues usually come from data, adapter, or layout setup.
- Validate counts first, then inspect rendering configuration.
- Always set a layout manager and use proper row dimensions.
- Keep update flow explicit with notify calls or immutable list submissions.
- Use a fixed debug checklist to resolve the problem quickly and repeatably.
Related reading
- RecyclerView - Get view at particular position
- RecyclerView and java.lang.IndexOutOfBoundsException Inconsistency detected. Invalid view holder adapter positionViewHolder in Samsung devices
- RecyclerView blinking after notifyDatasetChanged
- RecyclerView Inconsistency detected. Invalid item position
- RecyclerView inside ScrollView is not working
- recyclerview No adapter attached; skipping layout
- Recyclerview not call onCreateViewHolder
- Recyclerview not call onCreateViewHolder
.png&w=3840&q=75)
Tackling System Design Interview Problems
A short course that equips you with the skills to approach system design interviews methodically.
Start the free courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.