53

The recyclerview layout is defined as

     <android.support.v7.widget.RecyclerView
            android:layout_marginTop="15dp"
            android:id="@+id/call_detail_list"
            android:scrollbars="vertical"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            tools:listitem="@layout/call_item"
            />

In the preview, I can see the list items from the specified layout, but the number of item is 10. Is there any way that can be changed?

shakdwipeea
  • 775
  • 2
  • 7
  • 14
  • I have been looking into this as well without success. There's nothing specified in the documentation. https://developer.android.com/studio/write/tool-attributes.html#design-time_view_attributes – Javier Mendonça Jan 26 '17 at 09:16
  • You should accept the answer from @Diego Alejandro about setting `tools:itemCount="3"`. – Magnus Oct 02 '18 at 08:38

2 Answers2

121

Try this (3 number of items)

tools:itemCount="3"

Diego Alvis
  • 1,785
  • 1
  • 13
  • 14
1

Not the best way to do it but you can limit the layout_height here so that it only shows enough items that fits within the height/width boundary. So play around with tools:layout_height="150dp"

Rubin Yoo
  • 2,674
  • 2
  • 24
  • 32
  • 1
    I tried this, but it seems that the tools:listitem argument overrides the layout height... For me the 10 list items still show up. – fgysin Aug 09 '17 at 12:18