Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Make GridView or GridLayoutManager items square.
import android.content.Context;
import android.util.AttributeSet;
import android.widget.FrameLayout;
public class SquareFrameLayout extends FrameLayout {
public SquareFrameLayout(Context context) {
public SquareFrameLayout(Context context, AttributeSet attrs) {
super(context, attrs);
public SquareFrameLayout(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
//noinspection SuspiciousNameCombination
super.onMeasure(widthMeasureSpec, widthMeasureSpec);

This comment has been minimized.

Copy link

ShreyashPromact commented Jan 24, 2017

Nice work dude.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.