setItemPrefetchEnabled

Sets whether the LayoutManager should be queried for views outside of its viewport while the UI thread is idle between frames.

If enabled, the LayoutManager will be queried for items to inflate/bind in between view system traversals on devices running API 21 or greater. Default value is true.

On platforms API level 21 and higher, the UI thread is idle between passing a frame to RenderThread and the starting up its next frame at the next VSync pulse. By prefetching out of window views in this time period, delays from inflation and view binding are much less likely to cause jank and stuttering during scrolls and flings.

While prefetch is enabled, it will have the side effect of expanding the effective size of the View cache to hold prefetched views.

Parameters

enabled

True if items should be prefetched in between traversals.

See also