Java tutorial
//package com.java2s; //License from project: Apache License import android.view.View; import android.view.View.MeasureSpec; public class Main { public static void calcViewMeasure(View view) { int width = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED); int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); view.measure(width, expandSpec); } }