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


Java PopupWindow.setHeight方法代码示例

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


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

示例1: create

import android.widget.PopupWindow; //导入方法依赖的package包/类
public static PopupWindow create(@NonNull Context context, @NonNull BubbleLayout bubbleLayout) {

        PopupWindow popupWindow = new PopupWindow(context);

        popupWindow.setContentView(bubbleLayout);
        popupWindow.setOutsideTouchable(true);
        popupWindow.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT);
        popupWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
        popupWindow.setAnimationStyle(android.R.style.Animation_Dialog);
        // change background color to transparent
        Drawable drawable;
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            drawable = context.getDrawable(R.drawable.popup_window_transparent);
        } else {
            drawable = context.getResources().getDrawable(R.drawable.popup_window_transparent);
        }
        popupWindow.setBackgroundDrawable(drawable);

        return popupWindow;
    }
 
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:21,代码来源:BubblePopupHelper.java

示例2: ListFilePopWindow

import android.widget.PopupWindow; //导入方法依赖的package包/类
public ListFilePopWindow(Context context, View targetView) {
    super();
    this.targetView = targetView;
    View contentView = LayoutInflater.from(context).inflate(R.layout.kf5_list_file_dir, null);
    listView = (ListView) contentView.findViewById(R.id.kf5_list_dir);
    Point point = ScreenUtils.getScreenSize(context);
    int height = (int) (point.y * (4.5f / 8.0f));
    popupWindow = new PopupWindow();
    popupWindow.setWidth(ViewGroup.LayoutParams.MATCH_PARENT);
    popupWindow.setHeight(height);
    popupWindow.setBackgroundDrawable(new BitmapDrawable());
    popupWindow.setOutsideTouchable(true);
    popupWindow.setFocusable(true);
    popupWindow.setTouchable(true);
    popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {

        @Override
        public void onDismiss() {
            // TODO Auto-generated method stub
            popupWindow.dismiss();
        }
    });
    popupWindow.setAnimationStyle(R.style.KF5FileListPopAnim);
    popupWindow.setContentView(contentView);
    listView.setOnItemClickListener(this);
}
 
开发者ID:Zyj163,项目名称:yyox,代码行数:27,代码来源:ListFilePopWindow.java

示例3: progressPopUp

import android.widget.PopupWindow; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
public void  progressPopUp(final Activity context,String data){
	
	RelativeLayout layoutId = (RelativeLayout)context.findViewById(R.id.dialog_rootView);
	LayoutInflater layoutInflater  = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
	View layout = layoutInflater.inflate(R.layout.progresspopup, layoutId);
	txtWaiting = (TextView)layout.findViewById(R.id.txtWaiting);

	paymentAlert = new PopupWindow(context);
	paymentAlert.setContentView(layout);		
	paymentAlert.setHeight(WindowManager.LayoutParams.MATCH_PARENT);		
	paymentAlert.setWidth(WindowManager.LayoutParams.MATCH_PARENT);
	paymentAlert.setFocusable(true);		
	paymentAlert.setBackgroundDrawable(new BitmapDrawable());
	paymentAlert.showAtLocation(layout, Gravity.CENTER, 0, 0);	
	if(data !=null)
		txtWaiting.setText(data);
   }
 
开发者ID:mityung,项目名称:XERUNG,代码行数:19,代码来源:ProgressDialog.java

示例4: getMenuOptionPopup

import android.widget.PopupWindow; //导入方法依赖的package包/类
/** A popup to select the type of message to send, "Text", "Image", "Location".*/
public static PopupWindow getMenuOptionPopup(Context context, View.OnClickListener listener){
    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View popupView = inflater.inflate(R.layout.chat_sdk_popup_options, null);
    PopupWindow optionPopup = new PopupWindow(popupView, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, true);
    popupView.findViewById(R.id.chat_sdk_btn_choose_picture).setOnClickListener(listener);
    popupView.findViewById(R.id.chat_sdk_btn_take_picture).setOnClickListener(listener);
    popupView.findViewById(R.id.chat_sdk_btn_location).setOnClickListener(listener);

    if (!BDefines.Options.LocationEnabled || context.getString(R.string.google_maps_api_key).isEmpty()){
        popupView.findViewById(R.id.chat_sdk_btn_location).setVisibility(View.GONE);
    }
    
    popupView.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);

    // TODO fix popup size to wrap view size.
    optionPopup.setContentView(popupView);
    optionPopup.setBackgroundDrawable(new BitmapDrawable());
    optionPopup.setOutsideTouchable(true);
    optionPopup.setWidth(popupView.getMeasuredWidth());
    optionPopup.setHeight(popupView.getMeasuredHeight());
    return optionPopup;
}
 
开发者ID:MobileDev418,项目名称:AndroidBackendlessChat,代码行数:24,代码来源:DialogUtils.java

示例5: showPopUpWindow

import android.widget.PopupWindow; //导入方法依赖的package包/类
private void showPopUpWindow(View view) {
    WindowManager systemService = (WindowManager) this.getSystemService(Context.WINDOW_SERVICE);
    int width = systemService.getDefaultDisplay().getWidth();
    int height = systemService.getDefaultDisplay().getHeight();
    int popWidth = (int) (width * 0.75);
    int popHeight = (int) (height * 0.64);
    PopupWindow popupWindow = new PopupWindow(this);
    popupWindow.setWidth(popWidth);
    popupWindow.setHeight(popHeight);
    View inflate = LayoutInflater.from(this).inflate(R.layout.ll_life_detail_pop,null);
    popupWindow.setContentView(inflate);
    popupWindow.setClippingEnabled(false);//设置覆盖状态栏,重点
    popupWindow.setBackgroundDrawable(getResources().getDrawable(R.drawable.rl_pop_top_corner));
    popupWindow.setOutsideTouchable(false);
    popupWindow.setFocusable(true);
    popupWindow.showAtLocation(view, Gravity.CENTER,0,0);

    initPopUpView(inflate);

}
 
开发者ID:funnyzhaov,项目名称:Tribe,代码行数:21,代码来源:LifeDetailActivity.java

示例6: CursorHandle

import android.widget.PopupWindow; //导入方法依赖的package包/类
public CursorHandle(boolean isLeft) {
    super(mContext);
    this.isLeft = isLeft;
    mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mPaint.setColor(mCursorHandleColor);

    mPopupWindow = new PopupWindow(this);
    mPopupWindow.setClippingEnabled(false);
    mPopupWindow.setWidth(mWidth + mPadding * 2);
    mPopupWindow.setHeight(mHeight + mPadding / 2);
    invalidate();
}
 
开发者ID:shenhuanet,项目名称:SelectableTextProvider,代码行数:13,代码来源:SelectableTextProvider.java

示例7: showPop

import android.widget.PopupWindow; //导入方法依赖的package包/类
private void showPop() {
        final PopupWindow popupWindow = new PopupWindow(this,null,R.style.bottomDialog);
        View view = LayoutInflater.from(this).inflate(R.layout.popup, null);
        popupWindow.setContentView(view);

        popupWindow.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT);
        popupWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);

        popupWindow.setOutsideTouchable(true);
        popupWindow.setTouchable(true);

//                popupWindow.setAnimationStyle(R.style.);

        popupWindow.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#88000000")));
//                popupWindow.showAsDropDown(mButton7, 0, -mButton7.getHeight());//在view下方

        //如果是0,0的话,默认是在这个view(anchor锚)的左下角作为起始点
        //Gravity.RIGHT代表在view的右下角开始 这个是api19开始支持


        //这种显示方式如果是和view无关,里面只是为了获得token
        popupWindow.showAtLocation(mButton7, Gravity.BOTTOM|Gravity.LEFT,100,200);
        //这个x y的位置是先计算重力所在的位置,然后再以那个位置为左上角,x,y是相对位置

        //如果是Gravity.BOTTOM   设置y值不能为负值
        //设置了重力后坐标系的方向就变了,如果是Gravity.BOTTOM 那么y轴的方向就是向上
    }
 
开发者ID:pop1234o,项目名称:BestPracticeApp,代码行数:28,代码来源:MainPopUpWindowActivity.java

示例8: getPopupWindow

import android.widget.PopupWindow; //导入方法依赖的package包/类
/**
 * 生成并设置PopupWindow对话框
 *
 * @param view
 * @return
 */
private PopupWindow getPopupWindow(View view) {
    PopupWindow popupWindow = new PopupWindow(mContext);
    popupWindow.setContentView(view);
    popupWindow.setWidth(WindowManager.LayoutParams.MATCH_PARENT);
    popupWindow.setHeight(WindowManager.LayoutParams.WRAP_CONTENT);
    popupWindow.setBackgroundDrawable(new ColorDrawable(Color.WHITE));
    popupWindow.setFocusable(true);
    popupWindow.setOutsideTouchable(true);
    return popupWindow;
}
 
开发者ID:codekongs,项目名称:ImageClassify,代码行数:17,代码来源:ModifyUserInfoPresenter.java

示例9: showKey

import android.widget.PopupWindow; //导入方法依赖的package包/类
private void showKey(final int keyIndex) {
    final PopupWindow previewPopup = mPreviewPopup;
    final Key[] keys = mKeys;
    if (keyIndex < 0 || keyIndex >= mKeys.length) return;
    Key key = keys[keyIndex];
    if (key.icon != null) {
        mPreviewText.setCompoundDrawables(null, null, null,
                key.iconPreview != null ? key.iconPreview : key.icon);
        mPreviewText.setText(null);
    } else {
        mPreviewText.setCompoundDrawables(null, null, null, null);
        mPreviewText.setText(getPreviewText(key));
        if (key.label.length() > 1 && key.codes.length < 2) {
            mPreviewText.setTextSize(TypedValue.COMPLEX_UNIT_PX, mKeyTextSize);
            mPreviewText.setTypeface(Typeface.DEFAULT_BOLD);
        } else {
            mPreviewText.setTextSize(TypedValue.COMPLEX_UNIT_PX, mPreviewTextSizeLarge);
            mPreviewText.setTypeface(Typeface.DEFAULT);
        }
    }
    mPreviewText.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED),
            MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
    int popupWidth = Math.max(mPreviewText.getMeasuredWidth(), key.width
            + mPreviewText.getPaddingLeft() + mPreviewText.getPaddingRight());
    final int popupHeight = mPreviewHeight;
    LayoutParams lp = mPreviewText.getLayoutParams();
    if (lp != null) {
        lp.width = popupWidth;
        lp.height = popupHeight;
    }
    if (!mPreviewCentered) {
        mPopupPreviewX = key.x - mPreviewText.getPaddingLeft() + mPaddingLeft;
        mPopupPreviewY = key.y - popupHeight + mPreviewOffset;
    } else {
        // TODO: Fix this if centering is brought back
        mPopupPreviewX = 160 - mPreviewText.getMeasuredWidth() / 2;
        mPopupPreviewY = -mPreviewText.getMeasuredHeight();
    }
    mHandler.removeMessages(MSG_REMOVE_PREVIEW);
    getLocationInWindow(mCoordinates);
    mCoordinates[0] += mMiniKeyboardOffsetX; // Offset may be zero
    mCoordinates[1] += mMiniKeyboardOffsetY; // Offset may be zero

    // Set the preview background state
    mPreviewText.getBackground().setState(
            key.popupResId != 0 ? LONG_PRESSABLE_STATE_SET : EMPTY_STATE_SET);
    mPopupPreviewX += mCoordinates[0];
    mPopupPreviewY += mCoordinates[1];

    // If the popup cannot be shown above the key, put it on the side
    getLocationOnScreen(mCoordinates);
    if (mPopupPreviewY + mCoordinates[1] < 0) {
        // If the key you're pressing is on the left side of the keyboard, show the popup on
        // the right, offset by enough to see at least one key to the left/right.
        if (key.x + key.width <= getWidth() / 2) {
            mPopupPreviewX += (int) (key.width * 2.5);
        } else {
            mPopupPreviewX -= (int) (key.width * 2.5);
        }
        mPopupPreviewY += popupHeight;
    }

    if (previewPopup.isShowing()) {
        previewPopup.update(mPopupPreviewX, mPopupPreviewY,
                popupWidth, popupHeight);
    } else {
        previewPopup.setWidth(popupWidth);
        previewPopup.setHeight(popupHeight);
        previewPopup.showAtLocation(mPopupParent, Gravity.NO_GRAVITY,
                mPopupPreviewX, mPopupPreviewY);
    }
    mPreviewText.setVisibility(VISIBLE);
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:74,代码来源:MyKeyboardView.java

示例10: showLongPressEmojiTip

import android.widget.PopupWindow; //导入方法依赖的package包/类
private void showLongPressEmojiTip() {
    PopupWindow popupWindow = new PopupWindow(getContext());
    popupWindow.setWidth(ViewGroup.LayoutParams.MATCH_PARENT);
    popupWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
    popupWindow.setContentView(LayoutInflater.from(getContext()).inflate(R.layout.layout_bubble, null));
    popupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    popupWindow.setOutsideTouchable(true);
    popupWindow.showAsDropDown(mTextInputEditText, 0, 30, Gravity.CENTER_HORIZONTAL);
}
 
开发者ID:auv1107,项目名称:TextEmoji,代码行数:10,代码来源:EmojiFragment.java


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