Android examples for User Interface:ViewGroup
Calculates the fetched height of the given ViewGroup layout in pixels.
//package com.java2s; import android.view.ViewGroup; import android.view.ViewGroup.LayoutParams; public class Main { /**/*from w ww .jav a 2s.c om*/ * Calculates the fetched height of the given layout in pixels. * * @param aLayout * The layout to measure. * @return the height of the given layout. */ public static int calcHeight(final ViewGroup aLayout) { final LayoutParams params = aLayout.getLayoutParams(); final int height = params.height; params.height = LayoutParams.WRAP_CONTENT; aLayout.measure(0, 0); final int measuredHeight = aLayout.getMeasuredHeight(); params.height = height; return measuredHeight; } }