calculate View Measure - Android User Interface

Android examples for User Interface:View Size

Description

calculate View Measure

Demo Code


//package com.java2s;

import android.view.View;

public class Main {

    public static void calcViewMeasure(View view) {


        int width = View.MeasureSpec.makeMeasureSpec(0,
                View.MeasureSpec.UNSPECIFIED);
        int expandSpec = View.MeasureSpec.makeMeasureSpec(
                Integer.MAX_VALUE >> 2, View.MeasureSpec.AT_MOST);
        view.measure(width, expandSpec);
    }//from   w ww.j  a  va 2 s  .  com
}

Related Tutorials