Code example for View

Methods: getLayoutParams, getMeasuredHeight, getMeasuredState, getMeasuredWidth, getVisibility

0
 
        int topInset = 0;
        int bottomInset = 0;
 
        measureChildWithMargins(mActionBarTop, widthMeasureSpec, 0, heightMeasureSpec, 0);
        LayoutParams lp = (LayoutParams) mActionBarTop.getLayoutParams();
        maxWidth = Math.max(maxWidth,
                mActionBarTop.getMeasuredWidth() + lp.leftMargin + lp.rightMargin);
        maxHeight = Math.max(maxHeight,
                mActionBarTop.getMeasuredHeight() + lp.topMargin + lp.bottomMargin);
        childState = combineMeasuredStates(childState, mActionBarTop.getMeasuredState());
 
        // xlarge screen layout doesn't have bottom action bar. 
        if (mActionBarBottom != null) {
            measureChildWithMargins(mActionBarBottom, widthMeasureSpec, 0, heightMeasureSpec, 0);
            lp = (LayoutParams) mActionBarBottom.getLayoutParams();
            maxWidth = Math.max(maxWidth,
                    mActionBarBottom.getMeasuredWidth() + lp.leftMargin + lp.rightMargin);
            maxHeight = Math.max(maxHeight,
                    mActionBarBottom.getMeasuredHeight() + lp.topMargin + lp.bottomMargin);
            childState = combineMeasuredStates(childState, mActionBarBottom.getMeasuredState());
        } 
 
        final int vis = getWindowSystemUiVisibility();
        final boolean stable = (vis & SYSTEM_UI_FLAG_LAYOUT_STABLE) != 0;
 
        if (stable) {
            // This is the standard space needed for the action bar.  For stable measurement, 
            // we can't depend on the size currently reported by it -- this must remain constant. 
            topInset = mActionBarHeight;
            if (mActionBar != null && mActionBar.hasNonEmbeddedTabs()) {
                View tabs = mContainerView.getTabContainer();
                if (tabs != null) {
                    // If tabs are not embedded, increase space on top to account for them. 
                    topInset += mActionBarHeight;
                } 
            } 
        } else if (mActionBarTop.getVisibility() == VISIBLE) {
            // This is the space needed on top of the window for all of the action bar 
            // and tabs. 
            topInset = mActionBarTop.getMeasuredHeight();
        } 
 
        if (mActionView.isSplitActionBar()) {
            // If action bar is split, adjust bottom insets for it. 
            if (mActionBarBottom != null) {