Created
December 2, 2016 20:57
-
-
Save fcaldarelli/75f52c3dd01a6c8fd60f60d56840c11b to your computer and use it in GitHub Desktop.
Square Percent Relative Layout
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
import android.annotation.TargetApi; | |
import android.content.Context; | |
import android.os.Build; | |
import android.support.percent.PercentRelativeLayout; | |
import android.util.AttributeSet; | |
import android.widget.RelativeLayout; | |
public class SquarePercentRelativeLayout extends PercentRelativeLayout { | |
public SquarePercentRelativeLayout(Context context) { | |
super(context); | |
} | |
public SquarePercentRelativeLayout(Context context, AttributeSet attrs) { | |
super(context, attrs); | |
} | |
public SquarePercentRelativeLayout(Context context, AttributeSet attrs, int defStyleAttr) { | |
super(context, attrs, defStyleAttr); | |
} | |
@Override | |
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { | |
// Set a square layout. | |
super.onMeasure(widthMeasureSpec, widthMeasureSpec); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment