Code example for PopupWindow

Methods: getBackgroundgetContentViewgetMaxAvailableHeight

0
            } 
 
            dropDownView = mDropDownList;
            mPopup.setContentView(dropDownView);
        } else { 
            dropDownView = (ViewGroup) mPopup.getContentView();
        } 
 
        // getMaxAvailableHeight() subtracts the padding, so we put it back 
        // to get the available height for the whole window 
        int padding = 0;
        Drawable background = mPopup.getBackground();
        if (background != null) {
            background.getPadding(mTempRect);
            padding = mTempRect.top + mTempRect.bottom;
 
            // If we don't have an explicit vertical offset, determine one from the window 
            // background so that content will line up. 
            if (!mDropDownVerticalOffsetSet) {
                mDropDownVerticalOffset = -mTempRect.top;
            } 
        } 
 
        final int maxHeight = mPopup.getMaxAvailableHeight(
                getAnchorView(), mDropDownVerticalOffset);
 
        if (mDropDownAlwaysVisible || mDropDownHeight == ViewGroup.LayoutParams.MATCH_PARENT) {
            return maxHeight + padding;
        }