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

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

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

PopupWindow.getWidth介绍

暂无

代码示例

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

public PopupWindowAssert hasWidth(int width) {
 isNotNull();
 int actualWidth = actual.getWidth();
 assertThat(actualWidth) //
   .overridingErrorMessage("Expected width <%s> but was <%s>.", width, actualWidth) //
   .isEqualTo(width);
 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 hasWidth(int width) {
 isNotNull();
 int actualWidth = actual.getWidth();
 assertThat(actualWidth) //
   .overridingErrorMessage("Expected width <%s> but was <%s>.", width, actualWidth) //
   .isEqualTo(width);
 return this;
}

代码示例来源: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

class MyHeaderBar extends HeaderBar {
private int defaultWidth = 0;
...
private PopupWindow getPopupWindow() {
 try{
  Field field = HeaderBar.class.getDeclaredField("mPopupWindow");
  field.setAccessible(true);
  Object value = field.get(this);
  field.setAccessible(false);

  if (value != null && PopupWindow.class.isAssignableFrom(value.getClass())) {
    return (PopupWindow) value;
  }
 } catch (NoSuchFieldException e) {
 } catch (IllegalAccessException e) {}

 return null;
}

@Override
public vod showPopupWindow() {
 super.showPopupWindow();
 PopupWindow pw = getPopupWindow();
 if (defaultWidth == 0) 
  defaultWidth = pw.getWidth();
 pw.setFixedWidth((int)(defaultWidth * 1.15));  
}
...
}

代码示例来源: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: stackoverflow.com

popup.setFocusable(true);
popupWidth = popup.getWidth();

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

int anchHeight=anchor.getHeight();
int winWidth=window.getWidth();
int winHeight=window.getHeight();
View view=window.getContentView();

代码示例来源: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

x = mCandidateContainer.getWidth() - mFloatingWindow.getWidth();
   y = candSpacing;
   break;
   break;
  case BOTTOM_RIGHT:
   x = mCandidateContainer.getWidth() - mFloatingWindow.getWidth();
   y = mParentLocation[1] - mFloatingWindow.getHeight() - candSpacing;
   break;
if (x > mCandidateContainer.getWidth() - mFloatingWindow.getWidth()) {
 x = mCandidateContainer.getWidth() - mFloatingWindow.getWidth();
 mFloatingWindow.showAtLocation(mCandidateContainer, Gravity.START | Gravity.TOP, x, y);
} else {
 mFloatingWindow.update(x, y, mFloatingWindow.getWidth(), mFloatingWindow.getHeight());

相关文章