当前位置: 首页>>代码示例>>Java>>正文


Java PopupWindow.INPUT_METHOD_NOT_NEEDED属性代码示例

本文整理汇总了Java中android.widget.PopupWindow.INPUT_METHOD_NOT_NEEDED属性的典型用法代码示例。如果您正苦于以下问题:Java PopupWindow.INPUT_METHOD_NOT_NEEDED属性的具体用法?Java PopupWindow.INPUT_METHOD_NOT_NEEDED怎么用?Java PopupWindow.INPUT_METHOD_NOT_NEEDED使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.widget.PopupWindow的用法示例。


在下文中一共展示了PopupWindow.INPUT_METHOD_NOT_NEEDED属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isInputMethodNotNeeded

private boolean isInputMethodNotNeeded() {
    return mPopup.getInputMethodMode() == PopupWindow.INPUT_METHOD_NOT_NEEDED;
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:3,代码来源:IcsListPopupWindow.java

示例2: buildDropDown

/**
 * <p>Builds the popup window's content and returns the height the popup
 * should have. Returns -1 when the content already exists.</p>
 *
 * @return the content's wrap content height or -1 if content already exists
 */
private int buildDropDown() {
    int otherHeights = 0;

    // getMaxAvailableHeight() subtracts the padding, so we put it back
    // to get the available height for the whole window.
    final int paddingVert;
    final int paddingHoriz;
    final Drawable background = mPopup.getBackground();
    if (background != null) {
        background.getPadding(mTempRect);
        paddingVert = mTempRect.top + mTempRect.bottom;
        paddingHoriz = mTempRect.left + mTempRect.right;

        // If we don't have an explicit vertical offset, determine one from
        // the window background so that content will line up.
        if (!mVerticalOffsetSet) {
            mVerticalOffset = -mTempRect.top;
        }
    } else {
        mTempRect.setEmpty();
        paddingVert = 0;
        paddingHoriz = 0;
    }

    // Redefine dimensions taking into account maxWidth and maxHeight.
    final boolean ignoreBottomDecorations = mPopup.getInputMethodMode() == PopupWindow.INPUT_METHOD_NOT_NEEDED;
    final int maxContentHeight = Build.VERSION.SDK_INT >= Build.VERSION_CODES.N ?
            mPopup.getMaxAvailableHeight(getAnchorView(), mVerticalOffset, ignoreBottomDecorations) :
            mPopup.getMaxAvailableHeight(getAnchorView(), mVerticalOffset);
    final int maxContentWidth = mContext.getResources().getDisplayMetrics().widthPixels - paddingHoriz;

    mMaxHeight = Math.min(maxContentHeight + paddingVert, mUserMaxHeight);
    mMaxWidth = Math.min(maxContentWidth + paddingHoriz, mUserMaxWidth);
    // if (mHeight > 0) mHeight = Math.min(mHeight, maxContentHeight);
    // if (mWidth > 0) mWidth = Math.min(mWidth, maxContentWidth);

    if (mAlwaysVisible || mHeight == ViewGroup.LayoutParams.MATCH_PARENT) {
        return mMaxHeight;
    }

    final int childWidthSpec;
    switch (mWidth) {
        case ViewGroup.LayoutParams.WRAP_CONTENT:
            childWidthSpec = View.MeasureSpec.makeMeasureSpec(maxContentWidth, View.MeasureSpec.AT_MOST); break;
        case ViewGroup.LayoutParams.MATCH_PARENT:
            childWidthSpec = View.MeasureSpec.makeMeasureSpec(maxContentWidth, View.MeasureSpec.EXACTLY); break;
        default:
            //noinspection Range
            childWidthSpec = View.MeasureSpec.makeMeasureSpec(mWidth, View.MeasureSpec.EXACTLY); break;
    }

    // Add padding only if the list has items in it, that way we don't show
    // the popup if it is not needed. For this reason, we measure as wrap_content.
    mView.measure(childWidthSpec, View.MeasureSpec.makeMeasureSpec(maxContentHeight, View.MeasureSpec.AT_MOST));
    final int viewHeight = mView.getMeasuredHeight();
    if (viewHeight > 0) {
        otherHeights += paddingVert + mView.getPaddingTop() + mView.getPaddingBottom();
    }

    return Math.min(viewHeight + otherHeights, mMaxHeight);
}
 
开发者ID:natario1,项目名称:Autocomplete,代码行数:67,代码来源:AutocompletePopup.java

示例3: isInputMethodNotNeeded

/**
 * @return {@code true} if this popup is configured to assume the user does not need
 * to interact with the IME while it is showing, {@code false} otherwise.
 */
boolean isInputMethodNotNeeded() {
    return mPopup.getInputMethodMode() == PopupWindow.INPUT_METHOD_NOT_NEEDED;
}
 
开发者ID:natario1,项目名称:Autocomplete,代码行数:7,代码来源:AutocompletePopup.java


注:本文中的android.widget.PopupWindow.INPUT_METHOD_NOT_NEEDED属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。