Skip to content

Instantly share code, notes, and snippets.

View vyguera's full-sized avatar

Rubén Viguera Marañón vyguera

View GitHub Profile
@vyguera
vyguera / SpanningGridLayoutManager.java
Created February 20, 2020 08:49 — forked from janheinrichmerker/SpanningGridLayoutManager.java
GridLayoutManager implementation that stretches to fit all grid items on screen and disables scrolling. Useful for dashboards etc.
package com.example;
import android.content.Context
import android.util.AttributeSet
import android.view.ViewGroup
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
import kotlin.math.ceil
import kotlin.math.roundToInt