本文整理了Java中android.widget.PopupWindow.showAsDropDown()
方法的一些代码示例,展示了PopupWindow.showAsDropDown()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。PopupWindow.showAsDropDown()
方法的具体详情如下:
包路径:android.widget.PopupWindow
类名称:PopupWindow
方法名:showAsDropDown
暂无
代码示例来源:origin: facebook/litho
@Override
public void showLithoTooltip(
View container, Rect anchorBounds, int xOffset, int yOffset) {
popupWindow.showAsDropDown(
container, anchorBounds.left + xOffset, anchorBounds.bottom + yOffset);
}
},
代码示例来源:origin: facebook/litho
@Override
public void showBottomLeft(View anchor, int xOffset, int yOffset) {
popupWindow.showAsDropDown(anchor, xOffset, yOffset);
}
},
代码示例来源:origin: rey5137/material
@Override
public void showAsDropDown(View anchor, int xoff, int yoff) {
if (Build.VERSION.SDK_INT < 21 && mOverlapAnchor) {
// If we're pre-L, emulate overlapAnchor by modifying the yOff
yoff -= anchor.getHeight();
}
super.showAsDropDown(anchor, xoff, yoff);
}
代码示例来源:origin: rey5137/material
@TargetApi(Build.VERSION_CODES.KITKAT)
@Override
public void showAsDropDown(View anchor, int xoff, int yoff, int gravity) {
if (Build.VERSION.SDK_INT < 21 && mOverlapAnchor) {
// If we're pre-L, emulate overlapAnchor by modifying the yOff
yoff -= anchor.getHeight();
}
super.showAsDropDown(anchor, xoff, yoff, gravity);
}
代码示例来源:origin: smuyyh/BookReader
@Override
public void showAsDropDown(View anchor, int xoff, int yoff) {
lightoff();
super.showAsDropDown(anchor, xoff, yoff);
}
代码示例来源:origin: smuyyh/BookReader
@Override
public void showAsDropDown(View anchor, int xoff, int yoff) {
lightoff();
super.showAsDropDown(anchor, xoff, yoff);
}
代码示例来源:origin: GitLqr/LQRWeChat
/**
* 得到在指定某个视图外的popupwindow并显示
*
* @param contentView popupwindow要显示的视图
* @param width popupwindow的宽度
* @param height popupwindow的高度
* @param anchorView 参考视图
* @param xoff x轴偏移量
* @param yoff y轴偏移量
* @return
*/
public static PopupWindow getPopupWindowAsDropDown(View contentView, int width, int height, View anchorView, int xoff, int yoff) {
PopupWindow popupWindow = getPopupWindow(contentView, width, height);
popupWindow.showAsDropDown(anchorView, xoff, yoff);
return popupWindow;
}
代码示例来源:origin: stackoverflow.com
PopupWindow pw;
LayoutInflater inflater = (LayoutInflater)this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.weight_popup, (ViewGroup)findViewById(R.id.linlay_weight_popup));
pw = new PopupWindow(layout,LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT, true);
pw.setBackgroundDrawable(new BitmapDrawable());
pw.setOutsideTouchable(true);
pw.showAsDropDown(btnSelectWeight);
代码示例来源:origin: GitLqr/LQRWeChat
/**
* 得到在指定某个视图外的popupwindow并显示(该方法只支持4.4以上)
*
* @param contentView popupwindow要显示的视图
* @param width popupwindow的宽度
* @param height popupwindow的高度
* @param anchorView 参考视图
* @param gravityType 在参考视图外的相对位置
* @param xoff x轴偏移量
* @param yoff y轴偏移量
* @return
*/
@TargetApi(Build.VERSION_CODES.KITKAT)
public static PopupWindow getPopupWindowAsDropDown(View contentView, int width, int height, View anchorView, int gravityType, int xoff, int yoff) {
PopupWindow popupWindow = getPopupWindow(contentView, width, height);
popupWindow.showAsDropDown(anchorView, xoff, yoff, gravityType);
return popupWindow;
}
代码示例来源:origin: GitLqr/LQRWeChat
/**
* 得到一个自动识别在目标控件上方或下方的pupupwindow并显示
*
* @param contentView popupwindow要显示的视图
* @param width popupwindow的宽度
* @param activity 能得到getWindowManager()的上下文
* @return
*/
public static PopupWindow getPopupWindowAsDropDownParentAuto(View contentView, int width, int height, View anchorView, Activity activity) {
// View itemView = (View) contentView.getParent();// 得到contentView的父控件
PopupWindow popupWindow = getPopupWindow(contentView, width, height);
// 控制它放置的位置
if (isShowBottom(activity, anchorView)) {// 显示popupwindow在itemView的下方,偏移量都为0
popupWindow.showAsDropDown(anchorView, 0, 0);
} else {// 显示popupwindow在itemView的上方,偏移量y都为-2*itemView.getHeight()
popupWindow.showAsDropDown(anchorView, 0,
-2 * anchorView.getHeight());
}
return popupWindow;
}
代码示例来源:origin: stackoverflow.com
PopupWindow popup = new PopupWindow(contentView, width, height);
popup.setBackgroundDrawable(null);
popup.showAsDropDown(anchor);
WindowManager wm = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
WindowManager.LayoutParams p = (WindowManager.LayoutParams) contentView.getLayoutParams();
p.flags = WindowManager.LayoutParams.FLAG_DIM_BEHIND;
p.dimAmount = 0.3f;
wm.updateViewLayout(contentView, p);
代码示例来源:origin: jeasonlzy/NineGridView
@OnClick(R.id.more)
public void more(View view) {
View popupView = mInflater.inflate(R.layout.popup_reply, null);
popupView.findViewById(R.id.favour).setOnClickListener(this);
popupView.findViewById(R.id.comment).setOnClickListener(this);
window = new PopupWindow(popupView, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
window.setOutsideTouchable(true);
window.setFocusable(true);
window.setAnimationStyle(R.style.popup_more_anim);
window.setBackgroundDrawable(new ColorDrawable(Color.BLACK));
popupView.measure(0, 0);
int xoff = -popupView.getMeasuredWidth();
int yoff = -(popupView.getMeasuredHeight() + view.getHeight()) / 2;
window.showAsDropDown(view, xoff, yoff);
}
代码示例来源:origin: stackoverflow.com
PopupWindow popup = new PopupWindow(contentView, width, height);
popup.setBackgroundDrawable(background);
popup.showAsDropDown(anchor);
View container = (View) popup.getContentView().getParent();
WindowManager wm = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
WindowManager.LayoutParams p = (WindowManager.LayoutParams) container.getLayoutParams();
p.flags = WindowManager.LayoutParams.FLAG_DIM_BEHIND;
p.dimAmount = 0.3f;
wm.updateViewLayout(container, p);
代码示例来源:origin: arcadefire/nice-spinner
public void showDropDown() {
if (!isArrowHidden) {
animateArrow(true);
}
measurePopUpDimension();
popupWindow.showAsDropDown(this);
}
代码示例来源:origin: facebook/facebook-android-sdk
mPopupContent.getMeasuredWidth(),
mPopupContent.getMeasuredHeight());
mPopupWindow.showAsDropDown(mAnchorViewRef.get());
updateArrows();
if (mNuxDisplayTime > 0) {
代码示例来源:origin: stackoverflow.com
_p.setFocusable(true);
_p.setOutsideTouchable(true);
_p.showAsDropDown(view);
代码示例来源:origin: lipangit/JiaoZiVideoPlayer
clarityPopWindow.showAsDropDown(clarity);
layout.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
int offsetX = clarity.getMeasuredWidth() / 3;
代码示例来源:origin: mikepenz/Android-Iconics
int size = (int) UIUtils.convertDpToPixel(144, v.getContext());
mPopup = new PopupWindow(imageView, size, size);
mPopup.showAsDropDown(v);
代码示例来源:origin: termux/termux-app
void popup(View view, String text) {
int width = view.getMeasuredWidth();
int height = view.getMeasuredHeight();
Button button = new Button(getContext(), null, android.R.attr.buttonBarButtonStyle);
button.setText(text);
button.setTextColor(TEXT_COLOR);
button.setPadding(0, 0, 0, 0);
button.setMinHeight(0);
button.setMinWidth(0);
button.setMinimumWidth(0);
button.setMinimumHeight(0);
button.setWidth(width);
button.setHeight(height);
button.setBackgroundColor(BUTTON_PRESSED_COLOR);
popupWindow = new PopupWindow(this);
popupWindow.setWidth(LayoutParams.WRAP_CONTENT);
popupWindow.setHeight(LayoutParams.WRAP_CONTENT);
popupWindow.setContentView(button);
popupWindow.setOutsideTouchable(true);
popupWindow.setFocusable(false);
popupWindow.showAsDropDown(view, 0, -2 * height);
}
代码示例来源:origin: zyyoona7/EasyPopup
@Override
public void onRightClick(View view) {
if (mQQPop != null) {
mQQPop.showAsDropDown(view, -mQQPop.getContentView().getWidth() + SizeUtils.dp2px(30), 0);
}
}
内容来源于网络,如有侵权,请联系作者删除!