PopupWindow
popupWindow = new PopupWindow(view, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, true);
//实例化一个ColorDrawable颜色为半透明
ColorDrawable dw = new ColorDrawable(0x00000000);
//设置SelectPicPopupWindow弹出窗体的背景
popupWindow.setBackgroundDrawable(dw);
popupWindow.setOutsideTouchable(false);
popupWindow.setFocusable(true);
popupWindow.setAnimationStyle(R.style.PopupAnimation);
//在PopupWindow里面就加上下面代码,让键盘弹出时,不会挡住pop窗口。
popupWindow.setInputMethodMode(PopupWindow.INPUT_METHOD_NEEDED);
popupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
popupWindow.update();
popupWindow.showAtLocation(rl, Gravity.BOTTOM|Gravity.CENTER_HORIZONTAL, 0, 0);
- popupWindow去除黑边,只要给他设置背景就可以
- popupWindow可以根据屏幕的宽度和它显示在的控件的宽度来确定其显示的位置