Example usage for android.view View resolveSizeAndState

List of usage examples for android.view View resolveSizeAndState

Introduction

In this page you can find the example usage for android.view View resolveSizeAndState.

Prototype

public static int resolveSizeAndState(int size, int measureSpec, int childMeasuredState) 

Source Link

Document

Utility to reconcile a desired size and state, with constraints imposed by a MeasureSpec.

Usage

From source file:com.actionbarsherlock.internal.widget.IcsProgressBar.java

@Override
protected synchronized void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    Drawable d = mCurrentDrawable;//w w  w .j a v a  2  s .c  o m

    int dw = 0;
    int dh = 0;
    if (d != null) {
        dw = Math.max(mMinWidth, Math.min(mMaxWidth, d.getIntrinsicWidth()));
        dh = Math.max(mMinHeight, Math.min(mMaxHeight, d.getIntrinsicHeight()));
    }
    updateDrawableState();
    dw += getPaddingLeft() + getPaddingRight();
    dh += getPaddingTop() + getPaddingBottom();

    if (IS_HONEYCOMB) {
        setMeasuredDimension(View.resolveSizeAndState(dw, widthMeasureSpec, 0),
                View.resolveSizeAndState(dh, heightMeasureSpec, 0));
    } else {
        setMeasuredDimension(View.resolveSize(dw, widthMeasureSpec), View.resolveSize(dh, heightMeasureSpec));
    }
}

From source file:vapor.view.VaporView.java

/**
 * Utility to reconcile a desired size and state, with constraints imposed
 * by a MeasureSpec.//from   w  ww  .  j a  v a 2s  .c  o m
 * 
 * @param size
 *            How big the view wants to be
 * @param measureSpec
 *            Constraints imposed by the parent
 * @param childMeasuredState
 * @return Size information bit mask as defined by MEASURED_SIZE_MASK and
 *         MEASURED_STATE_TOO_SMALL.
 */
public static int resolve(int size, int measureSpec, int childMeasuredState) {
    return View.resolveSizeAndState(size, measureSpec, childMeasuredState);
}