android.widget.PopupWindow.getHeight()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(7.5k)|赞(0)|评价(0)|浏览(108)

本文整理了Java中android.widget.PopupWindow.getHeight()方法的一些代码示例,展示了PopupWindow.getHeight()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。PopupWindow.getHeight()方法的具体详情如下:
包路径:android.widget.PopupWindow
类名称:PopupWindow
方法名:getHeight

PopupWindow.getHeight介绍

暂无

代码示例

代码示例来源:origin: square/assertj-android

public PopupWindowAssert hasHeight(int height) {
 isNotNull();
 int actualHeight = actual.getHeight();
 assertThat(actualHeight) //
   .overridingErrorMessage("Expected height <%s> but was <%s>.", height, actualHeight) //
   .isEqualTo(height);
 return this;
}

代码示例来源:origin: pinguo-zhouwei/CustomPopwindow

@Override
  public boolean onTouch(View v, MotionEvent event) {
    final int x = (int) event.getX();
    final int y = (int) event.getY();
    if ((event.getAction() == MotionEvent.ACTION_DOWN)
        && ((x < 0) || (x >= mWidth) || (y < 0) || (y >= mHeight))) {
      Log.e(TAG,"out side ");
      Log.e(TAG,"width:"+mPopupWindow.getWidth()+"height:"+mPopupWindow.getHeight()+" x:"+x+" y  :"+y);
      return true;
    } else if (event.getAction() == MotionEvent.ACTION_OUTSIDE) {
      Log.e(TAG,"out side ...");
      return true;
    }
    return false;
  }
});

代码示例来源:origin: supertaohaili/book

@Override
  public boolean onTouch(View v, MotionEvent event) {
    final int x = (int) event.getX();
    final int y = (int) event.getY();
    if ((event.getAction() == MotionEvent.ACTION_DOWN)
        && ((x < 0) || (x >= mWidth) || (y < 0) || (y >= mHeight))) {
      Log.e(TAG,"out side ");
      Log.e(TAG,"width:"+mPopupWindow.getWidth()+"height:"+mPopupWindow.getHeight()+" x:"+x+" y  :"+y);
      return true;
    } else if (event.getAction() == MotionEvent.ACTION_OUTSIDE) {
      Log.e(TAG,"out side ...");
      return true;
    }
    return false;
  }
});

代码示例来源:origin: com.willowtreeapps/oak-demos

public boolean onTouch(View v, MotionEvent event) {
    final int action = event.getAction();
    final int x = (int) event.getX();
    final int y = (int) event.getY();
    if (action == MotionEvent.ACTION_DOWN &&
        mPopup != null && mPopup.isShowing() &&
        (x >= 0 && x < mPopup.getWidth() && y >= 0 && y < mPopup.getHeight())) {
      mHandler.postDelayed(mResizePopupRunnable, EXPAND_LIST_TIMEOUT);
    } else if (action == MotionEvent.ACTION_UP) {
      mHandler.removeCallbacks(mResizePopupRunnable);
    }
    return false;
  }
}

代码示例来源:origin: com.squareup.assertj/assertj-android

public PopupWindowAssert hasHeight(int height) {
 isNotNull();
 int actualHeight = actual.getHeight();
 assertThat(actualHeight) //
   .overridingErrorMessage("Expected height <%s> but was <%s>.", height, actualHeight) //
   .isEqualTo(height);
 return this;
}

代码示例来源:origin: WiInputMethod/VE

public void show() {
  if (!isShown()) {
    container.showAsDropDown(softKeyboard.keyboardLayout, leftMargin, -container.getHeight() - softKeyboard.keyboardParams.height);
  }
}

代码示例来源:origin: zhangliangming/HappyPlayer-AS

/**
 * 创建PopupWindow
 */
private void initPopuptWindow(String timeStr, View v, String lrc) {
  DisplayMetrics dm = new DisplayMetrics();
  dm = context.getResources().getDisplayMetrics();
  int screenWidth = dm.widthPixels;
  LayoutInflater layoutInflater = LayoutInflater.from(context);
  View popupWindow = layoutInflater.inflate(
      R.layout.seekbar_progress_dialog, null);
  tipTextView = (TextView) popupWindow.findViewById(R.id.tip);
  tipTextView.setText(timeStr + lrc);
  int padding = 25;
  mPopupWindow = new PopupWindow(popupWindow, screenWidth - padding * 2,
      80, true);
  // mPopupWindow = new PopupWindow(popupWindow, LayoutParams.FILL_PARENT,
  // LayoutParams.FILL_PARENT, true);
  // int[] location = new int[2];
  // this.getLocationInWindow(location); // 获取在当前窗口内的绝对坐标
  // this.getLocationOnScreen(location);//获取在整个屏幕内的绝对坐标
  // mPopupWindow.showAsDropDown(v, 0, v.getHeight() - 80);
  int[] location = new int[2];
  v.getLocationOnScreen(location);
  mPopupWindow.showAtLocation(v, Gravity.NO_GRAVITY, padding, location[1]
      - mPopupWindow.getHeight());
}

代码示例来源:origin: ViHtarb/Tooltip

@Override
  public void onScrollChanged() {
    PointF location = calculateLocation();
    mPopupWindow.update((int) location.x, (int) location.y, mPopupWindow.getWidth(), mPopupWindow.getHeight());
  }
};

代码示例来源:origin: stackoverflow.com

View popupView = layoutInflater.inflate(R.layout.popup_window, null);

  final PopupWindow popupWindow = new PopupWindow(popupView,
      LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);

  ImageButton btnCancel = (ImageButton) popupView
      .findViewById(R.id.btnCancel);

popupWindow.showAtLocation(LayoutView, Gravity.BOTTOM
      | Gravity.CENTER_HORIZONTAL, (LayoutView.getWidth() - popupView
      .getWidth()) / 2, LayoutView.getHeight()
      - popupWindow.getHeight() - 10);
  popupWindow.setAnimationStyle(Animation.RELATIVE_TO_SELF);
  popupWindow.setFocusable(true);
  popupWindow.update();

代码示例来源:origin: WiInputMethod/VE

public void showText(CharSequence text) {
  editText.setText(text);
  mText = text;
  float length = toolPaint.measureText((String) text);
  editText.setTextSize(DisplayUtil.px2sp(softKeyboard,
      Math.min(container.getHeight() * TEXTSIZE_RATE_BY_HEIGHT, TEXTSIZE_RATE_BY_WIDTH * container.getWidth() / length) * TEXTSIZE_RATE
  ));
  show();
}

代码示例来源:origin: lb377463323/GraphicsTestBed

private void showPopupWindow(PopupWindow popupWindow, View view) {
  if (popupWindow != null && view != null && !popupWindow.isShowing()) {
    int[] location = new int[2];
    view.getLocationOnScreen(location);
    popupWindow.showAtLocation(view, Gravity.NO_GRAVITY, location[0], location[1] - popupWindow.getHeight());
  } else {
    if (popupWindow != null) {
      popupWindow.dismiss();
    }
  }
}

代码示例来源:origin: leibing8912/HttpRequest

/**
 * 复制、删除窗体显示
 * @author leibing
 * @createTime 2017/5/5
 * @lastModify 2017/5/5
 * @param v 位置参照物
 * @param onClick 点击事件
 * @return
 */
private void showPopUps(View v, View.OnClickListener onClick){
  View popLayout = LayoutInflater.from(this).inflate(R.layout.pop_jk_chat, null);
  TextView copyTv = (TextView) popLayout.findViewById(R.id.tv_pop_jk_copy);
  TextView delTv = (TextView) popLayout.findViewById(R.id.tv_pop_jk_del);
  copyTv.setOnClickListener(onClick);
  delTv.setOnClickListener(onClick);
  popupWindow = new PopupWindow(popLayout, 240, 100);
  popupWindow.setFocusable(true);
  popupWindow.setOutsideTouchable(true);
  popupWindow.setBackgroundDrawable(new BitmapDrawable());
  int[] location = new int[2];
  v.getLocationOnScreen(location);
  popupWindow.showAtLocation(v, Gravity.NO_GRAVITY, location[0] + v.getMeasuredWidth() / 3,
      location[1]-popupWindow.getHeight());
}

代码示例来源:origin: leibing8912/HttpRequest

v.getLocationOnScreen(location);
popupWindow.showAtLocation(v, Gravity.NO_GRAVITY, location[0] + v.getMeasuredWidth() / 3,
    location[1]-popupWindow.getHeight());

代码示例来源:origin: jzyhywxz/PopupWindow

int winHeight=window.getHeight();
View view=window.getContentView();
if(winWidth<=0)

代码示例来源:origin: ViHtarb/Tooltip

@Override
  public void onGlobalLayout() {
    ViewTreeObserverCompat.removeOnGlobalLayoutListener(mContentView.getViewTreeObserver(), this);
    final ViewTreeObserver vto = mAnchorView.getViewTreeObserver();
    if (vto != null) {
      vto.addOnScrollChangedListener(mOnScrollChangedListener);
    }
    if (mArrowView != null) {
      mContentView.getViewTreeObserver().addOnGlobalLayoutListener(mArrowLayoutListener);
    }
    PointF location = calculateLocation();
    mPopupWindow.setClippingEnabled(true);
    mPopupWindow.update((int) location.x, (int) location.y, mPopupWindow.getWidth(), mPopupWindow.getHeight());
  }
};

代码示例来源:origin: osfans/trime

case BOTTOM_RIGHT:
   x = mCandidateContainer.getWidth() - mFloatingWindow.getWidth();
   y = mParentLocation[1] - mFloatingWindow.getHeight() - candSpacing;
   break;
  case DRAG:
  default:
   x = 0;
   y = mParentLocation[1] - mFloatingWindow.getHeight() - candSpacing;
   break;
  y =
    (int) mPopupRectF.top
      - mFloatingWindow.getHeight()
      - candSpacing;
if (y > mParentLocation[1] - mFloatingWindow.getHeight() - candSpacing) { //candSpacing爲負時,可覆蓋部分鍵盤
 y = mParentLocation[1] - mFloatingWindow.getHeight() - candSpacing;
 mFloatingWindow.showAtLocation(mCandidateContainer, Gravity.START | Gravity.TOP, x, y);
} else {
 mFloatingWindow.update(x, y, mFloatingWindow.getWidth(), mFloatingWindow.getHeight());

相关文章