epoxy-adapter / com.airbnb.epoxy / Carousel / setNumViewsToShowOnScreen

setNumViewsToShowOnScreen

open fun setNumViewsToShowOnScreen(viewCount: Float): Unit

Set the number of views to show on screen in this carousel at a time, partial numbers are allowed.

This is useful where you want to easily control for the number of items on screen, regardless of screen size. For example, you could set this to 1.2f so that one view is shown in full and 20% of the next view "peeks" from the edge to indicate that there is more content to scroll to.

Another pattern is setting a different view count depending on whether the device is phone or tablet.

Additionally, if a LinearLayoutManager is used this value will be forwarded to as a performance optimization.

If you want to only change the prefetch count without changing the view size you can simply use #setInitialPrefetchItemCount(int)