Android Dev Summit, October 23-24: two days of technical content, directly from the Android team. Sign-up for livestream updates.

ItemCap

interface ItemCap
androidx.car.widget.PagedListView.ItemCap

Interface for a RecyclerView.Adapter to cap the number of items.

NOTE: it is still up to the adapter to use maxItems in .

the recommended way would be with:

<code>{}Override
      public int getItemCount() {
        return Math.min(super.getItemCount(), mMaxItems);
      }
      </code>

Summary

Constants

static Int

A value to pass to setMaxItems(int) that indicates there should be no limit.

Public methods

abstract Unit
setMaxItems(maxItems: Int)

Sets the maximum number of items available in the adapter.

Constants

UNLIMITED

static val UNLIMITED: Int

A value to pass to setMaxItems(int) that indicates there should be no limit.

Value: -1

Public methods

setMaxItems

abstract fun setMaxItems(maxItems: Int): Unit

Sets the maximum number of items available in the adapter. A value less than '0' means the list should not be capped.