public static <T extends View> T measure(T view, ViewGroup parent) {
        LayoutParams p = view.getLayoutParams();
        int w = parent != null && p.width == MATCH_PARENT ? parent.getMeasuredWidth() : p.width;
        int h = parent != null && p.height == MATCH_PARENT ? parent.getMeasuredHeight() : p.height;
        return measure(view, w, h);
    }
public static <T extends View> T measure(T view, ViewGroup parent) {
        LayoutParams p = view.getLayoutParams();
        int w = parent != null && p.width == MATCH_PARENT ? parent.getMeasuredWidth() : p.width;
        int h = parent != null && p.height == MATCH_PARENT ? parent.getMeasuredHeight() : p.height;
        return measure(view, w, h);
    }
public static < T extends View > T measure ( T view , ViewGroup parent ) { LayoutParams p = view . getLayoutParams ( ) ; int w = parent != null && p . width == MATCH_PARENT ? parent . getMeasuredWidth ( ) : p . width ; int h = parent != null && p . height == MATCH_PARENT ? parent . getMeasuredHeight ( ) : p . height ; return measure ( view , w , h ) ; }
{@link View#measure(int, int) Measure} the View in its parent. You can then call
{@link View#getMeasuredWidth()} and {@link View#getMeasuredHeight()}.

@param view   must have {@link LayoutParams}
@param parent must already be measured
{ @link View#measure ( int int ) Measure } the View in its parent . You can then call { @link View#getMeasuredWidth () } and { @link View#getMeasuredHeight () } .