public static PercentLayoutInfo getPercentLayoutInfo(Context context,
                                                         AttributeSet attrs) {
        PercentLayoutInfo info = null;
        TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.PercentLayout_Layout);
        float value = array.getFraction(R.styleable.PercentLayout_Layout_layout_widthPercent, 1, 1,
                -1f);
        if (value != -1f) {
            if (VERBOSE) {
                Log.v(TAG, "percent width: " + value);
            }
            info = info != null ? info : new PercentLayoutInfo();
            info.widthPercent = value;
        }
        value = array.getFraction(R.styleable.PercentLayout_Layout_layout_heightPercent, 1, 1, -1f);
        if (value != -1f) {
            if (VERBOSE) {
                Log.v(TAG, "percent height: " + value);
            }
            info = info != null ? info : new PercentLayoutInfo();
            info.heightPercent = value;
        }
        value = array.getFraction(R.styleable.PercentLayout_Layout_layout_marginPercent, 1, 1, -1f);
        if (value != -1f) {
            if (VERBOSE) {
                Log.v(TAG, "percent margin: " + value);
            }
            info = info != null ? info : new PercentLayoutInfo();
            info.leftMarginPercentX = value;
            info.topMarginPercentY = value;
            info.rightMarginPercentX = value;
            info.bottomMarginPercentY = value;
        }
        value = array.getFraction(R.styleable.PercentLayout_Layout_layout_marginLeftPercentX, 1, 1,
                -1f);
        if (value != -1f) {
            if (VERBOSE) {
                Log.v(TAG, "percent left margin: " + value);
            }
            info = info != null ? info : new PercentLayoutInfo();
            info.leftMarginPercentX = value;
        }
        value = array.getFraction(R.styleable.PercentLayout_Layout_layout_marginLeftPercentY, 1, 1,
                -1f);
        if (value != -1f) {
            if (VERBOSE) {
                Log.v(TAG, "percent left margin: " + value);
            }
            info = info != null ? info : new PercentLayoutInfo();
            info.leftMarginPercentY = value;
        }
        value = array.getFraction(R.styleable.PercentLayout_Layout_layout_marginLeftPercentScreenX, 1, 1,
                -1f);
        if (value != -1f) {
            if (VERBOSE) {
                Log.v(TAG, "percent left margin: " + value);
            }
            info = info != null ? info : new PercentLayoutInfo();
            info.leftMarginPercentScreenX = value;
        }
        value = array.getFraction(R.styleable.PercentLayout_Layout_layout_marginTopPercentX, 1, 1,
                -1f);
        if (value != -1f) {
            if (VERBOSE) {
                Log.v(TAG, "percent top margin: " + value);
            }
            info = info != null ? info : new PercentLayoutInfo();
            info.topMarginPercentX = value;
        }
        value = array.getFraction(R.styleable.PercentLayout_Layout_layout_marginTopPercentY, 1, 1,
                -1f);
        if (value != -1f) {
            if (VERBOSE) {
                Log.v(TAG, "percent top margin: " + value);
            }
            info = info != null ? info : new PercentLayoutInfo();
            info.topMarginPercentY = value;
        }
        value = array.getFraction(R.styleable.PercentLayout_Layout_layout_marginTopPercentScreenX, 1, 1,
                -1f);
        if (value != -1f) {
            if (VERBOSE) {
                Log.v(TAG, "percent top margin: " + value);
            }
            info = info != null ? info : new PercentLayoutInfo();
            info.topMarginPercentScreenX = value;
        }
        value = array.getFraction(R.styleable.PercentLayout_Layout_layout_marginRightPercentX, 1, 1,
                -1f);
        if (value != -1f) {
            if (VERBOSE) {
                Log.v(TAG, "percent right margin: " + value);
            }
            info = info != null ? info : new PercentLayoutInfo();
            info.rightMarginPercentX = value;
        }
        value = array.getFraction(R.styleable.PercentLayout_Layout_layout_marginRightPercentY, 1, 1,
                -1f);
        if (value != -1f) {
            if (VERBOSE) {
                Log.v(TAG, "percent right margin: " + value);
            }
            info = info != null ? info : new PercentLayoutInfo();
            info.rightMarginPercentY = value;
        }
        value = array.getFraction(R.styleable.PercentLayout_Layout_layout_marginRightPercentScreenX, 1, 1,
                -1f);
        if (value != -1f) {
            if (VERBOSE) {
                Log.v(TAG, "percent right margin: " + value);
            }
            info = info != null ? info : new PercentLayoutInfo();
            info.rightMarginPercentScreenX = value;
        }
        value = array.getFraction(R.styleable.PercentLayout_Layout_layout_marginBottomPercentX, 1, 1,
                -1f);
        if (value != -1f) {
            if (VERBOSE) {
                Log.v(TAG, "percent bottom margin: " + value);
            }
            info = info != null ? info : new PercentLayoutInfo();
            info.bottomMarginPercentX = value;
        }
        value = array.getFraction(R.styleable.PercentLayout_Layout_layout_marginBottomPercentY, 1, 1,
                -1f);
        if (value != -1f) {
            if (VERBOSE) {
                Log.v(TAG, "percent bottom margin: " + value);
            }
            info = info != null ? info : new PercentLayoutInfo();
            info.bottomMarginPercentY = value;
        }
        value = array.getFraction(R.styleable.PercentLayout_Layout_layout_marginBottomPercentScreenX, 1, 1,
                -1f);
        if (value != -1f) {
            if (VERBOSE) {
                Log.v(TAG, "percent bottom margin: " + value);
            }
            info = info != null ? info : new PercentLayoutInfo();
            info.bottomMarginPercentScreenX = value;
        }
        value = array.getFraction(R.styleable.PercentLayout_Layout_layout_marginStartPercent, 1, 1,
                -1f);
        if (value != -1f) {
            if (VERBOSE) {
                Log.v(TAG, "percent start margin: " + value);
            }
            info = info != null ? info : new PercentLayoutInfo();
            info.startMarginPercent = value;
        }
        value = array.getFraction(R.styleable.PercentLayout_Layout_layout_marginEndPercent, 1, 1,
                -1f);
        if (value != -1f) {
            if (VERBOSE) {
                Log.v(TAG, "percent end margin: " + value);
            }
            info = info != null ? info : new PercentLayoutInfo();
            info.endMarginPercent = value;
        }

        value = array.getFraction(R.styleable.PercentLayout_Layout_layout_aspectRatio, 1, 1, -1f);
        if (value != -1f) {
            if (VERBOSE) {
                Log.v(TAG, "aspect ratio: " + value);
            }
            info = info != null ? info : new PercentLayoutInfo();
            info.aspectRatio = value;
        }

        value = array.getFraction(R.styleable.PercentLayout_Layout_layout_widthTextSizePercent, 1, 1, -1f);
        if (value != -1f) {
            if (VERBOSE) {
                Log.v(TAG, "width percent text size: " + value);
            }
            info = info != null ? info : new PercentLayoutInfo();
            info.widthTextSizePercent = value;
        }

        value = array.getFraction(R.styleable.PercentLayout_Layout_layout_screenWidthTextSizePercent, 1, 1, -1f);
        if (value != -1f) {
            if (VERBOSE) {
                Log.v(TAG, "width percent text size: " + value);
            }
            info = info != null ? info : new PercentLayoutInfo();
            info.screenWidthTextSizePercent = value;
        }
        value = array.getFraction(R.styleable.PercentLayout_Layout_layout_heightTextSizePercent, 1, 1, -1f);
        if (value != -1f) {
            if (VERBOSE) {
                Log.v(TAG, "height percent text size: " + value);
            }
            info = info != null ? info : new PercentLayoutInfo();
            info.heightTextSizePercent = value;
        }

        array.recycle();
        if (DEBUG) {
            Log.d(TAG, "constructed: " + info);
        }
        return info;
    }
Constructs a PercentLayoutInfo from attributes associated with a View. Call this method from
{@code LayoutParams(Context c, AttributeSet attrs)} constructor.
common/src/main/java/com/sxjs/common/widget/percentlayout/PercentLayoutHelper.java