本文整理了Java中android.widget.PopupWindow.setBackgroundDrawable()
方法的一些代码示例,展示了PopupWindow.setBackgroundDrawable()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。PopupWindow.setBackgroundDrawable()
方法的具体详情如下:
包路径:android.widget.PopupWindow
类名称:PopupWindow
方法名:setBackgroundDrawable
暂无
代码示例来源:origin: GitLqr/LQRWeChat
/**
* 点击popupwindow范围以外的地方时隐藏
*
* @param popupWindow
*/
public static void openOutsideTouchable(PopupWindow popupWindow) {
popupWindow.setBackgroundDrawable(new BitmapDrawable());
popupWindow.setOutsideTouchable(true);
}
代码示例来源: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: 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: 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: 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: aa112901/remusic
@Override
protected void onPreExecute() {
super.onPreExecute();
View view;
if (popupWindow == null) {
LayoutInflater layoutInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = layoutInflater.inflate(R.layout.loading_circle, null);
popupWindow = new PopupWindow(view, 200, 220);
}
popupWindow.setFocusable(true);
popupWindow.setOutsideTouchable(true);
// 这个是为了点击“返回Back”也能使其消失,并且并不会影响你的背景
popupWindow.setBackgroundDrawable(new BitmapDrawable());
popupWindow.showAtLocation(mContext.getWindow().getDecorView(), Gravity.CENTER, 0, 0);
popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
@Override
public void onDismiss() {
RequestThreadPool.finish();
cancel(true);
}
});
}
代码示例来源:origin: pili-engineering/PLDroidPlayer
private void initFloatingWindow() {
mWindow = new PopupWindow(mContext);
mWindow.setFocusable(false);
mWindow.setBackgroundDrawable(null);
mWindow.setOutsideTouchable(true);
mAnimStyle = android.R.style.Animation;
}
代码示例来源:origin: HotBitmapGG/bilibili-android-client
private void initFloatingWindow() {
mWindow = new PopupWindow(mContext);
mWindow.setFocusable(false);
mWindow.setBackgroundDrawable(null);
mWindow.setOutsideTouchable(true);
mAnimStyle = android.R.style.Animation;
}
代码示例来源:origin: jeasonlzy/NineGridView
editWindow.setOutsideTouchable(true);
editWindow.setFocusable(true);
editWindow.setBackgroundDrawable(new ColorDrawable(Color.WHITE));
代码示例来源:origin: arcadefire/nice-spinner
popupWindow.setBackgroundDrawable(ContextCompat.getDrawable(context, R.drawable.spinner_drawable));
} else {
popupWindow.setBackgroundDrawable(ContextCompat.getDrawable(context, R.drawable.drop_down_shadow));
代码示例来源:origin: ZieIony/Carbon
if (clearFocusOnTouchOutside) {
PopupWindow popupWindow = new PopupWindow(getContext());
popupWindow.setBackgroundDrawable(new ColorDrawable(0x7fff0000));
popupWindow.setTouchable(true);
popupWindow.setAnimationStyle(0);
代码示例来源:origin: Bearded-Hen/Android-Bootstrap
private void createDropDown() {
ScrollView dropdownView = createDropDownView();
dropdownWindow = new PopupWindow();
dropdownWindow.setFocusable(true);
dropdownWindow.setHeight(WindowManager.LayoutParams.WRAP_CONTENT);
if (!isInEditMode()) {
dropdownWindow.setBackgroundDrawable(DrawableUtils.resolveDrawable(android.R.drawable
.dialog_holo_light_frame, getContext()));
}
dropdownWindow.setContentView(dropdownView);
dropdownWindow.setOnDismissListener(this);
dropdownWindow.setAnimationStyle(android.R.style.Animation_Activity);
float longestStringWidth = measureStringWidth(getLongestString(dropdownData))
+ DimenUtils.dpToPixels((baselineItemRightPadding + baselineItemLeftPadding) * bootstrapSize);
if (longestStringWidth < getMeasuredWidth()) {
dropdownWindow.setWidth(DimenUtils.dpToPixels(getMeasuredWidth()));
}
else {
dropdownWindow.setWidth((int) longestStringWidth + DimenUtils.dpToPixels(8));
}
}
代码示例来源:origin: zyyoona7/EasyPopup
private void initCirclePop() {
View view = LayoutInflater.from(this).inflate(R.layout.layout_circle_comment, null);
mCiclePop = new PopupWindow(view, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
mCiclePop.setAnimationStyle(R.style.RightPopAnim);
mCiclePop.setFocusable(true);
mCiclePop.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
mCiclePop.setOutsideTouchable(true);
}
代码示例来源:origin: zyyoona7/EasyPopup
private void initQQPop() {
View view = LayoutInflater.from(this).inflate(R.layout.layout_right_pop, null);
mQQPop = new PopupWindow(view, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
mQQPop.setAnimationStyle(R.style.RightTopPopAnim);
mQQPop.setFocusable(true);
mQQPop.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
mQQPop.setOutsideTouchable(true);
}
代码示例来源:origin: zyyoona7/EasyPopup
private void initWeiboPop() {
View view = LayoutInflater.from(this).inflate(R.layout.layout_center_pop, null);
mWeiboPop = new PopupWindow(view, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
mWeiboPop.setAnimationStyle(R.style.TopPopAnim);
mWeiboPop.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
mWeiboPop.setFocusable(true);
mWeiboPop.setOutsideTouchable(false);
}
}
代码示例来源:origin: pili-engineering/PLDroidShortVideo
private void initFloatingWindow() {
mWindow = new PopupWindow(mContext);
mWindow.setFocusable(false);
mWindow.setBackgroundDrawable(null);
mWindow.setOutsideTouchable(true);
mAnimStyle = android.R.style.Animation;
}
代码示例来源:origin: curtis2/SuperVideoPlayer
private void initFloatingWindow() {
mWindow = new PopupWindow(mContext);
mWindow.setFocusable(false);
mWindow.setBackgroundDrawable(null);
mWindow.setOutsideTouchable(true);
mAnimStyle = android.R.style.Animation;
}
代码示例来源:origin: willowtreeapps/Hyperion-Android
private PopupWindow createDetailWindowForView(View view) {
final Context context = getContext();
final int width = (int) (getMeasuredWidth() * (4f / 5));
final int height = getMeasuredHeight() / 2;
final AttributeDetailView detailView = new AttributeDetailView(context);
detailView.setTarget(view);
PopupWindow popupWindow = new PopupWindow(detailView, width, height);
popupWindow.setBackgroundDrawable(new ColorDrawable(ContextCompat.getColor(context, R.color.ha_popup_background)));
popupWindow.setOutsideTouchable(true);
popupWindow.setFocusable(true);
return popupWindow;
}
代码示例来源:origin: zyyoona7/EasyPopup
mPopupWindow.setBackgroundDrawable(null);
mPopupWindow.setFocusable(mFocusable);
mPopupWindow.setOutsideTouchable(mOutsideTouchable);
mPopupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
代码示例来源:origin: pinguo-zhouwei/CustomPopwindow
private void test(){
LayoutInflater inflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View contentview = inflater.inflate(R.layout.pop_layout1, null);
final PopupWindow popupWindow = new PopupWindow(contentview, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
//popupWindow
popupWindow.setFocusable(true);
popupWindow.setOutsideTouchable(false);
popupWindow.setBackgroundDrawable(null);
popupWindow.getContentView().setFocusable(true); // 这个很重要
popupWindow.getContentView().setFocusableInTouchMode(true);
popupWindow.getContentView().setOnKeyListener(new View.OnKeyListener() {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
popupWindow.dismiss();
return true;
}
return false;
}
});
popupWindow.showAsDropDown(mButton1, 0, 10);
}
内容来源于网络,如有侵权,请联系作者删除!