CarouselLayoutManager

A LayoutManager that can mask and offset items along the scrolling axis, creating a unique list optimized for a stylized viewing experience.

CarouselLayoutManager requires all children to use MaskableFrameLayout as their root ViewGroup.

Note that when Carousel measures and lays out items, the first item in the adapter will be measured and it's desired size will be used to determine an appropriate size for all items in the carousel.

For more information, see the component developer guidance and design guidelines.

Constructors

Link copied to clipboard
constructor()
constructor(@NonNull strategy: CarouselStrategy)
constructor(@NonNull strategy: CarouselStrategy, orientation: Int)
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int)

Properties

Link copied to clipboard
Aligns large items to the center of the carousel.
Link copied to clipboard
Aligns large items to the start of the carousel.
Link copied to clipboard
Link copied to clipboard
val HORIZONTAL: Int = 0
Horizontal orientation for Carousel.
Link copied to clipboard
val VERTICAL: Int = 1
Vertical orientation for Carousel.

Functions

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Compute the extent of the horizontal scrollbar thumb.
Link copied to clipboard
Calculate the offset of the horizontal scrollbar thumb within the horizontal range.
Link copied to clipboard
Compute the horizontal range represented by the horizontal scroll bars.
Link copied to clipboard
Link copied to clipboard
Gets the height of the carousel container.
Link copied to clipboard
Gets the width of the carousel container.
Link copied to clipboard
open fun getDecoratedBoundsWithMargins(@NonNull view: View, @NonNull outBounds: Rect)
Returns the masked, decorated bounds with margins for view.
Link copied to clipboard
open fun getOrientation(): Int
Returns the current orientation of the layout.
Link copied to clipboard
Link copied to clipboard
open fun isHorizontal(): Boolean
Whether or not the orientation is horizontal.
Link copied to clipboard
open fun measureChildWithMargins(@NonNull child: View, widthUsed: Int, heightUsed: Int)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun onFocusSearchFailed(@NonNull focused: View, focusDirection: Int, @NonNull recycler: RecyclerView.Recycler, @NonNull state: RecyclerView.State): View
Link copied to clipboard
open fun onItemsAdded(@NonNull recyclerView: RecyclerView, positionStart: Int, itemCount: Int)
Link copied to clipboard
open fun onItemsRemoved(@NonNull recyclerView: RecyclerView, positionStart: Int, itemCount: Int)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun requestChildRectangleOnScreen(@NonNull parent: RecyclerView, @NonNull child: View, @NonNull rect: Rect, immediate: Boolean, focusedChildVisible: Boolean): Boolean
Link copied to clipboard
Link copied to clipboard
open fun scrollToPosition(position: Int)
Link copied to clipboard
Link copied to clipboard
open fun setCarouselStrategy(@NonNull carouselStrategy: CarouselStrategy)
Sets the CarouselStrategy used by this layout manager to mask and offset child views as they move along the scrolling axis.
Link copied to clipboard
open fun setDebuggingEnabled(@NonNull recyclerView: RecyclerView, enabled: Boolean)
Enables features to help debug keylines and other internal layout manager logic.
Link copied to clipboard
open fun setOrientation(orientation: Int)
Sets the orientation of the layout.
Link copied to clipboard
open fun smoothScrollToPosition(recyclerView: RecyclerView, state: RecyclerView.State, position: Int)