PopupWindow基础设置

来源:互联网 发布:golang select 编辑:程序博客网 时间:2024/06/05 10:41

popupWindow=new PopupWindow(MainActivity.this);
View popupView=getLayoutInflater().inflate(R.layout.selectedpopupwindow, null);

popupWindow.setContentView(popupView);

popupWindow.setWidth(LayoutParams.MATCH_PARENT);

popupWindow.setHeight(LayoutParams.MATCH_PARENT);

popupWindow.setBackgroundDrawable(new BitmapDrawable());


setBackgroundDrawable如果不设置这个弹出框会有点上移的感觉,

这里可以设置new BitmapDrawable(),也可以new ColorDrawable(),也可以直接null,就都不会有问题了,不知道具体是什么意思



popupWindow.setFocusable(true);

popupWindow.setOutsideTouchable(true);


打开popupWindow.showAtPosition(XX,XX,X,X);

关闭popupWindow: popupWindow.dismiss();

0 0
原创粉丝点击