PopupWindow getContentView - 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 getContentView method.

This code example shows how to use the following methods:getContentView
        yOffset = yoff;
        showAsDropDown(anchor);
    } 
 
    public boolean dispatchTouchEvent(MotionEvent e) {
        return onTouchInterceptor != null && onTouchInterceptor.onTouch(realPopupWindow.getContentView(), e);
    } 
 
    private WindowManager getWindowManager() {
        return (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    } 
 
    public int getXOffset() { 
        return xOffset;
    } 
 
    public int getYOffset() { 
        return yOffset;
    } 
} 
7
CodeRank
This code example shows how to use the following methods:getContentView, isShowing, showAtLocation
		if (event.getAction() == MotionEvent.ACTION_DOWN || event.getAction() == MotionEvent.ACTION_MOVE) {
			if (mPopupWindow == null) {
				LayoutInflater mLayoutInflater = (LayoutInflater) getContext().getSystemService(
						Context.LAYOUT_INFLATER_SERVICE);
				View view = mLayoutInflater.inflate(android.R.layout.simple_list_item_1, null);
				mPopupWindow = new PopupWindow(view, 100, 100);
			} 
 
			if (!mPopupWindow.isShowing()) {
				mPopupWindow.showAtLocation(list, Gravity.CENTER, 0, 0);
			} 
			TextView tv = (TextView) mPopupWindow.getContentView().findViewById(android.R.id.text1);
			tv.setText(l[idx] + "");
 
			Log.d("onTouchEvent", l[idx] + "");
			if (idx >= 0 && idx <= 25)
				list.setSelection(az[idx]);
			return true; 
		} else if (event.getAction() == MotionEvent.ACTION_UP) {
			if (mPopupWindow != null && mPopupWindow.isShowing()) {
6
CodeRank
This code example shows how to use the following methods:getContentView, isShowing, update
      } catch (JSONException e) {
        // TODO Auto-generated catch block 
        e.printStackTrace();
      } 
    } 
    if (popupWindow.isShowing()) {
      // 表示中だったら場所を更新 
      View v = popupWindow.getContentView();
      int w = v.getMeasuredWidth();
      int h = v.getMeasuredHeight();
      popupWindow.update(x, y, w, h);
    } else { 
      // 非表示中だったらば相対位置に表示 
      popupWindow.showAtLocation(this, Gravity.CENTER, x, y);
    } 
  } 
 
  public void dismissPopupWindow() { 
    // 消す 
    if (popupWindow.isShowing()) {
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
This code example shows how to use the following methods:getContentView, setWindowLayoutMode
            ((ViewGroup) subTextView.getParent()).removeView(subTextView);
        } 
    } 
 
    private void measure(RenderCoordinates coordinates) {
        mPopup.setWindowLayoutMode(
                ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        mPopup.getContentView().setLayoutParams(
                new RelativeLayout.LayoutParams(
                        RelativeLayout.LayoutParams.WRAP_CONTENT,
                        RelativeLayout.LayoutParams.WRAP_CONTENT));
        mPopup.getContentView().measure(
                View.MeasureSpec.makeMeasureSpec(coordinates.getLastFrameViewportWidthPixInt(),
                        View.MeasureSpec.AT_MOST),
                View.MeasureSpec.makeMeasureSpec(coordinates.getLastFrameViewportHeightPixInt(),
                        View.MeasureSpec.AT_MOST));
    } 
 
    private float getAnchorOffset() { 
        final View root = mPopup.getContentView();
5
CodeRank
This code example shows how to use the following methods:getContentView, setWindowLayoutMode
            ((ViewGroup) subTextView.getParent()).removeView(subTextView);
        } 
    } 
 
    private void measure(RenderCoordinates coordinates) {
        mPopup.setWindowLayoutMode(
                ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        mPopup.getContentView().setLayoutParams(
                new RelativeLayout.LayoutParams(
                        RelativeLayout.LayoutParams.WRAP_CONTENT,
                        RelativeLayout.LayoutParams.WRAP_CONTENT));
        mPopup.getContentView().measure(
                View.MeasureSpec.makeMeasureSpec(coordinates.getLastFrameViewportWidthPixInt(),
                        View.MeasureSpec.AT_MOST),
                View.MeasureSpec.makeMeasureSpec(coordinates.getLastFrameViewportHeightPixInt(),
                        View.MeasureSpec.AT_MOST));
    } 
 
    private float getAnchorOffset() { 
        final View root = mPopup.getContentView();
5
CodeRank
This code example shows how to use the following methods:getBackground, getContentView, getInputMethodMode, isShowing, setContentView
        int heightSpec = 0;
 
        boolean noInputMethod = isInputMethodNotNeeded();
        //XXX mPopup.setAllowScrollingAnchorParent(!noInputMethod); 
 
        if (mPopup.isShowing()) {
            if (mDropDownWidth == ViewGroup.LayoutParams.MATCH_PARENT) {
                // The call to PopupWindow's update method below can accept -1 for any 
                // value you do not want to update. 
                widthSpec = -1;
            } else if (mDropDownWidth == ViewGroup.LayoutParams.WRAP_CONTENT) {
                widthSpec = mDropDownAnchorView.getWidth();
            } else { 
                widthSpec = mDropDownWidth;
            } 
 
            if (mDropDownHeight == ViewGroup.LayoutParams.MATCH_PARENT) {
                // The call to PopupWindow's update method below can accept -1 for any 
                // value you do not want to update. 
                heightSpec = noInputMethod ? height : ViewGroup.LayoutParams.MATCH_PARENT;

3
CodeRank
This code example shows how to use the following methods:getBackground, getContentView, getInputMethodMode, isShowing, setContentView
        int heightSpec = 0;
 
        boolean noInputMethod = isInputMethodNotNeeded();
        //XXX mPopup.setAllowScrollingAnchorParent(!noInputMethod); 
 
        if (mPopup.isShowing()) {
            if (mDropDownWidth == ViewGroup.LayoutParams.MATCH_PARENT) {
                // The call to PopupWindow's update method below can accept -1 for any 
                // value you do not want to update. 
                widthSpec = -1;
            } else if (mDropDownWidth == ViewGroup.LayoutParams.WRAP_CONTENT) {
                widthSpec = mDropDownAnchorView.getWidth();
            } else { 
                widthSpec = mDropDownWidth;
            } 
 
            if (mDropDownHeight == ViewGroup.LayoutParams.MATCH_PARENT) {
                // The call to PopupWindow's update method below can accept -1 for any 
                // value you do not want to update. 
                heightSpec = noInputMethod ? height : ViewGroup.LayoutParams.MATCH_PARENT;

2
CodeRank
This code example shows how to use the following methods:getContentView
        yOffset = yoff;
        showAsDropDown(anchor);
    } 
 
    public boolean dispatchTouchEvent(MotionEvent e) {
        return onTouchInterceptor != null && onTouchInterceptor.onTouch(realPopupWindow.getContentView(), e);
    } 
 
    private WindowManager getWindowManager() {
        return (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    } 
 
    public int getXOffset() { 
        return xOffset;
    } 
 
    public int getYOffset() { 
        return yOffset;
    } 
} 
4
CodeRank
This code example shows how to use the following methods:getBackground, getContentView, getInputMethodMode, isShowing, setHeight
        int heightSpec = 0;
 
        boolean noInputMethod = isInputMethodNotNeeded();
        //XXX mPopup.setAllowScrollingAnchorParent(!noInputMethod); 
 
        if (mPopup.isShowing()) {
            if (mDropDownWidth == ViewGroup.LayoutParams.MATCH_PARENT) {
                // The call to PopupWindow's update method below can accept -1 for any 
                // value you do not want to update. 
                widthSpec = -1;
            } else if (mDropDownWidth == ViewGroup.LayoutParams.WRAP_CONTENT) {
                widthSpec = mDropDownAnchorView.getWidth();
            } else { 
                widthSpec = mDropDownWidth;
            } 
 
            if (mDropDownHeight == ViewGroup.LayoutParams.MATCH_PARENT) {
                // The call to PopupWindow's update method below can accept -1 for any 
                // value you do not want to update. 
                heightSpec = noInputMethod ? height : ViewGroup.LayoutParams.MATCH_PARENT;

1
CodeRank

Related PopupWindow getContentView Questions & Answers:

getContentView Method Overview
Return the view used as the content of the popup window.
See Code Examples for other Android PopupWindow Methods: