RecyclerView
Android Development
Single Item Display
Android UI
Mobile App Design

Recycler view showing single item

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions

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.

kotlin
val users = mutableListOf("Ava", "Noah", "Liam", "Mia")
Log.d("RV", "users size = ${users.size}")

If size is one at this stage, the bug is upstream in repository or mapper logic.

Then verify adapter exposes the same count.

kotlin
1class UserAdapter(private val items: MutableList<String>) : RecyclerView.Adapter<UserAdapter.VH>() {
2
3    class VH(view: View) : RecyclerView.ViewHolder(view) {
4        private val text: TextView = view.findViewById(android.R.id.text1)
5        fun bind(value: String) {
6            text.text = value
7        }
8    }
9
10    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
11        val v = LayoutInflater.from(parent.context)
12            .inflate(android.R.layout.simple_list_item_1, parent, false)
13        return VH(v)
14    }
15
16    override fun onBindViewHolder(holder: VH, position: Int) {
17        holder.bind(items[position])
18    }
19
20    override fun getItemCount(): Int = items.size
21}

Ensure Layout Manager Is Set

RecyclerView requires a layout manager.

kotlin
recyclerView.layoutManager = LinearLayoutManager(this)
recyclerView.adapter = UserAdapter(users)

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.

xml
1<LinearLayout
2    xmlns:android="http://schemas.android.com/apk/res/android"
3    android:layout_width="match_parent"
4    android:layout_height="wrap_content"
5    android:orientation="vertical"
6    android:padding="12dp">
7
8    <TextView
9        android:id="@+id/title"
10        android:layout_width="match_parent"
11        android:layout_height="wrap_content" />
12</LinearLayout>

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.

kotlin
items.addAll(listOf("Elena", "Lucas", "Riya"))
adapter.notifyItemRangeInserted(1, 3)

With ListAdapter, always submit a new list instance.

kotlin
val next = current + listOf("Elena", "Lucas")
adapter.submitList(next)

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:

  1. Log source data size.
  2. Log adapter getItemCount.
  3. Confirm layout manager assignment.
  4. Inspect row root height and parent constraints.
  5. Verify adapter notification or submitList calls.

This flow isolates most issues within minutes.

Common Pitfalls

  • Returning constant value from getItemCount during 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_parent in vertical list. Fix by using wrap_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
Free course
Beginner
7 lessons
2 hours
Tackling System Design Interview Problems

A short course that equips you with the skills to approach system design interviews methodically.

Start the free course
Track 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.

Browse interview questions

All Rights Reserved.