Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.support.v4.view.ViewCompat;

import android.view.View;

public class Main {
    public static int[] getViewSizeFromSpec(View view, int widthSpec, int heightSpec) {
        int minWidth = View.MeasureSpec.getSize(widthSpec) + view.getPaddingLeft() + view.getPaddingRight();
        int width = ViewCompat.resolveSizeAndState(minWidth, widthSpec, 1);

        int minHeight = View.MeasureSpec.getSize(heightSpec) + view.getPaddingBottom() + view.getPaddingTop();
        int height = ViewCompat.resolveSizeAndState(minHeight, heightSpec, 0);
        return new int[] { width, height };
    }
}