class AccessibilityGridLayoutManager( context: Context, spanCount: Int, ) : GridLayoutManager( context, spanCount, ) { override fun getColumnCountForAccessibility( recycler: RecyclerView.Recycler, state: RecyclerView.State, ): Int { return if (itemCount < spanCount) { itemCount } else { super.getColumnCountForAccessibility(recycler, state) } } }
A GridLayoutManager that can be used to override methods in Android implementation to improve ayy1 or fix a11y issues.