本文整理了Java中android.widget.PopupWindow.setElevation()
方法的一些代码示例,展示了PopupWindow.setElevation()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。PopupWindow.setElevation()
方法的具体详情如下:
包路径:android.widget.PopupWindow
类名称:PopupWindow
方法名:setElevation
暂无
代码示例来源:origin: arcadefire/nice-spinner
popupWindow.setElevation(DEFAULT_ELEVATION);
popupWindow.setBackgroundDrawable(ContextCompat.getDrawable(context, R.drawable.spinner_drawable));
} else {
代码示例来源:origin: InnoFang/Android-Code-Demos
private CustomPopupWindow(Builder builder) {
if (builder.contentViewId == 0 || builder.width == 0 || builder.height == 0) {
throw new IllegalArgumentException("The parameter is incomplete, be sure to contain contentView, width and height.");
}
mContext = builder.context;
mContentView = LayoutInflater.from(mContext).inflate(builder.contentViewId, null);
mPopupWindow = new PopupWindow(mContentView, builder.width, builder.height, builder.focus);
if (Build.VERSION.SDK_INT >= 21) mPopupWindow.setElevation(builder.elevation);
mPopupWindow.setOutsideTouchable(builder.outsideCancel);
mPopupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
mPopupWindow.setAnimationStyle(builder.animStyle);
}
代码示例来源:origin: duanhong169/ColorPicker
popupWindow.setElevation(10.0f);
代码示例来源:origin: ahmclishihao/gankS
/**
* 弹出一个popupwindow
*/
public static void getPopupWindow(View anchor, Context context, String text, final View.OnClickListener cl) {
Button button = new Button(context);
button.setBackgroundResource(R.drawable.selector_btn_save);
button.setText(text);
button.setTextColor(Color.BLACK);
button.setPadding(10, 5, 10, 5);
button.setOnClickListener(cl);
button.measure(0, 0);
final PopupWindow popupWindow = new PopupWindow(button, WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT, true);
popupWindow.setBackgroundDrawable(new BitmapDrawable());
// 设置背景和focusable使得可以点击消失
popupWindow.setFocusable(true);
if (Build.VERSION.SDK_INT >= 21)
popupWindow.setElevation(5);
popupWindow.showAsDropDown(anchor, anchor.getMeasuredWidth() / 2 - button.getMeasuredWidth() / 2, -anchor.getMeasuredHeight() / 2 - button.getMeasuredHeight() / 2);
// 回调 提供的监听
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// 两个View.OnClickListener不冲突
cl.onClick(v);
popupWindow.dismiss();
}
});
}
代码示例来源:origin: jaredrummler/MaterialSpinner
popupWindow.setElevation(16);
popupWindow.setBackgroundDrawable(Utils.getDrawable(context, R.drawable.ms__drawable));
} else {
代码示例来源:origin: osfans/trime
private void loadBackground() {
GradientDrawable gd = new GradientDrawable();
gd.setStroke(mConfig.getPixel("layout/border"), mConfig.getColor("border_color"));
gd.setCornerRadius(mConfig.getFloat("layout/round_corner"));
Drawable d = mConfig.getDrawable("layout/background");
if (d == null) {
gd.setColor(mConfig.getColor("text_back_color"));
d = gd;
}
if (mConfig.hasKey("layout/alpha")) {
int alpha = mConfig.getInt("layout/alpha");
if (alpha <= 0) alpha = 0;
else if (alpha >= 255) alpha = 255;
d.setAlpha(alpha);
}
mFloatingWindow.setBackgroundDrawable(d);
if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP)
mFloatingWindow.setElevation(mConfig.getPixel("layout/elevation"));
mCandidateContainer.setBackgroundColor(mConfig.getColor("back_color"));
}
代码示例来源:origin: yaozs/YzsLib
popupWindow.setElevation(DEFAULT_ELEVATION);
popupWindow.setBackgroundDrawable(ContextCompat.getDrawable(context, R.drawable.spinner_drawable));
} else {
内容来源于网络,如有侵权,请联系作者删除!