Last active
June 10, 2016 12:58
-
-
Save hector6872/7a18862b55f7b6db5da1 to your computer and use it in GitHub Desktop.
SquareRelativeLayout
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SquareRelativeLayout extends RelativeLayout { | |
public SquareRelativeLayout(Context context) { | |
this(context, null); | |
} | |
public SquareRelativeLayout(Context context, AttributeSet attrs) { | |
this(context, attrs, 0); | |
} | |
public SquareRelativeLayout(Context context, AttributeSet attrs, int defStyle) { | |
super(context, attrs, defStyle); | |
} | |
@Override | |
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { | |
int measureSpecSize = MeasureSpec.getSize(widthMeasureSpec); | |
this.setMeasuredDimension(measureSpecSize, measureSpecSize); | |
super.onMeasure(widthMeasureSpec, widthMeasureSpec); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment