AutoFitGridLayoutManager

A GridLayoutManager that automatically adjusts the number of columns to fit the available width.

This layout manager calculates the optimal number of columns based on the item width and the available width of the RecyclerView. It also takes into account the horizontal interval between items.

The columnWidth can be updated dynamically, and the layout manager will recalculate the span count accordingly. The span count can also be forced to a specific value.

Constructors

Link copied to clipboard
constructor(context: Context)

Properties

Link copied to clipboard
open override val logTag: String

Functions

Link copied to clipboard
open override fun onLayoutChildren(recycler: RecyclerView.Recycler?, state: RecyclerView.State?)
Link copied to clipboard
fun setSpanCount(spanCount: Int, forced: Boolean)

Sets the number of columns in the grid.