PopupWindow showAsDropDown - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for PopupWindow showAsDropDown method.

This code example shows how to use the following methods:setAnimationStyle, setBackgroundDrawable, setContentView, setFocusable, setHeight
        onShow(); 
 
        if (background == null) {
            mWindow.setBackgroundDrawable(new BitmapDrawable());
        } else { 
            mWindow.setBackgroundDrawable(background);
        } 
 
        mWindow.setWidth(WindowManager.LayoutParams.WRAP_CONTENT);
        mWindow.setHeight(WindowManager.LayoutParams.WRAP_CONTENT);
        mWindow.setTouchable(true);
        mWindow.setFocusable(true);
        mWindow.setOutsideTouchable(true);
 
        mWindow.setContentView(root);
    } 
 
    public void setBackgroundDrawable(Drawable background) {
        this.background = background;
    } 

8
CodeRank
This code example shows how to use the following methods:setBackgroundDrawable, setContentView, setFocusable, setHeight, setOutsideTouchable
        onShow(); 
 
        if (this.background == null) {
            this.window.setBackgroundDrawable(new BitmapDrawable());
        } else { 
            this.window.setBackgroundDrawable(this.background);
        } 
 
        // if using PopupWindow#setBackgroundDrawable this is the only values of 
        // the width and hight that make it work 
        // otherwise you need to set the background of the root viewgroup 
        // and set the popupwindow background to an empty BitmapDrawable 
        this.window.setWidth(WindowManager.LayoutParams.WRAP_CONTENT);
        this.window.setHeight(WindowManager.LayoutParams.WRAP_CONTENT);
        this.window.setTouchable(true);
        this.window.setFocusable(true);
        this.window.setOutsideTouchable(true);
 
        this.window.setContentView(this.root);
    } 

7
CodeRank
This code example shows how to use the following methods:dismiss, isShowing, setBackgroundDrawable, setOutsideTouchable, setTouchInterceptor
            popupTextView.setBackground(new ColorDrawable(SELECTED_COLOR_BACKGROUND));
            popupTextView.setTextColor(Color.BLACK);
            popupTextView.setText("error");
            popupTextView.setPadding(5, 3, 5, 3);
            popupLayout.addView(popupTextView);
            popupWindow = new PopupWindow( popupLayout, LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
            popupWindow.setBackgroundDrawable(new ColorDrawable(Color.BLACK));
            popupWindow.setOutsideTouchable(true);
            popupWindow.setTouchInterceptor(new OnTouchListener() {
                @Override 
                public boolean onTouch(View v, MotionEvent event) {
                    if(event.getAction() == MotionEvent.ACTION_OUTSIDE) {
                        popupWindow.dismiss();
                        return true; 
                    } 
                    return false; 
                } 
            }); 
        } 
        if (popupWindow.isShowing()) {

6
CodeRank
This code example shows how to use the following methods:setFocusable, setOutsideTouchable, showAsDropDown, update
This code example shows how to use the following methods:setFocusable, setOutsideTouchable, showAsDropDown, update
		int height = view.getMeasuredHeight();
		int[] location = new int[2];
 
		parent.getLocationInWindow(location);
		if (isLeft) {
			popupWindow.showAsDropDown(parent, -location[0],
					-parent.getHeight() - height);
		} else { 
			popupWindow.showAsDropDown(parent, 0, -parent.getHeight() - height);
		} 
		popupWindow.setFocusable(true);
		// 设置允许在外点击消失 
		popupWindow.setOutsideTouchable(true);
		// 刷新状态 
		popupWindow.update();
	} 
 
	// 隐藏菜单 
	public void dismiss() { 
		popupWindow.dismiss();
6
CodeRank
This code example shows how to use the following methods:getBackground, getMaxAvailableHeight, setHeight, setWidth, showAsDropDown
6
CodeRank
This code example shows how to use the following methods:setFocusable, setOutsideTouchable, showAsDropDown, update
		int height = contentView.getMeasuredHeight();
		int[] location = new int[2];
 
		parent.getLocationInWindow(location);
		if (isLeft) {
			popupWindow.showAsDropDown(parent, -location[0],
					-parent.getHeight() - height);
		} else { 
			popupWindow.showAsDropDown(parent, 0, -parent.getHeight() - height);
		} 
		popupWindow.setFocusable(true);
		// 设置允许在外点击消失 
		popupWindow.setOutsideTouchable(true);
		// 刷新状态 
		popupWindow.update();
	} 
 
	// 隐藏菜单 
	public void dismiss() { 
		 if (popupWindow != null && popupWindow.isShowing()) {
6
CodeRank
This code example shows how to use the following methods:setBackgroundDrawable, setContentView, setFocusable, setHeight, setOutsideTouchable
            if(mBackground == null) 
            {	 
                    mWindow.setBackgroundDrawable(new BitmapDrawable());
            } else  
            { 
                   	mWindow.setBackgroundDrawable(mBackground);
            } 
 
            // if using PopupWindow#setBackgroundDrawable this is the only values of the width and hight that make it work 
            // otherwise you need to set the background of the root viewgroup 
            // and set the popupwindow background to an empty BitmapDrawable 
            mWindow.setWidth(WindowManager.LayoutParams.WRAP_CONTENT);
            mWindow.setHeight(WindowManager.LayoutParams.WRAP_CONTENT);
            mWindow.setTouchable(true);
            mWindow.setFocusable(true);
            mWindow.setOutsideTouchable(true);
 
            mWindow.setContentView(mRootView);
    } 
 

6
CodeRank
This code example shows how to use the following methods:getWidth, setContentView, showAsDropDown
  } 
 
  public void showPopList() 
  { 
    this.mPopView.setBackgroundResource(this.mPopBgId);
    this.mPopWindow.setContentView(this.mPopView);
    this.mPopOffsetX = (this.mPopAnchorView.getWidth() - this.mPopWindow.getWidth() - (int)(0.5F + 9.0F * this.mContext.getResources().getDisplayMetrics().density));
    this.mPopWindow.showAsDropDown(this.mPopAnchorView, this.mPopOffsetX, this.mPopOffsetY);
  } 
 
  public void update() 
  { 
    if (this.mPopWindow != null)
      this.mPopWindow.update();
  } 
} 
 
/* Location:           C:\Users\sandrocheng.21KUNPENG\Desktop\classes_dex2jar.jar 
 * Qualified Name:     com.tencent.qqpimsecure.uilib.view.PopListView 
 * JD-Core Version:    0.6.2 
5
CodeRank
This code example shows how to use the following methods:getContentView, setContentView, setOnDismissListener, showAsDropDown
		View tView = mViewArray.get(selectPosition).getChildAt(0);
		if (tView instanceof ViewBaseAction) {
			ViewBaseAction f = (ViewBaseAction) tView;
			f.show();
		} 
		if (popupWindow.getContentView() != mViewArray.get(position)) {
			popupWindow.setContentView(mViewArray.get(position));
		} 
		popupWindow.showAsDropDown(this, 0, 0);
	} 
 
	/** 
	 * 如果菜单成展开状态,则让菜单收回 
	 */ 
	public boolean onPressBack() { 
		if (popupWindow != null && popupWindow.isShowing()) {
			popupWindow.dismiss();
			hideView(); 
			if (selectedButton != null) {
				selectedButton.setChecked(false);

5
CodeRank

Related PopupWindow showAsDropDown Questions & Answers:

showAsDropDown Method Overview
Display the content view in a popup window anchored to the bottom-left corner of the anchor view offset by the specified x and y coordinates.
See Code Examples for other Android PopupWindow Methods: