prepare View To Get Size - Android User Interface

Android examples for User Interface:View Size

Description

prepare View To Get Size

Demo Code


//package com.java2s;

import android.view.View;

public class Main {
    public static void prepareViewToGetSize(View view) {
        view.measure(View.MeasureSpec.makeMeasureSpec(0,
                View.MeasureSpec.UNSPECIFIED), View.MeasureSpec
                .makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
        view.layout(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight());
    }/*from   w  w w  . jav a 2s. c  o  m*/
}

Related Tutorials