FabrizioCaldarelli
12/2/2016 - 8:57 PM

Square Percent Relative Layout

Square Percent Relative Layout

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);
    }

}