how to make popupwindow background blur in android

Solutions on MaxInterview for how to make popupwindow background blur in android by the best coders in the world

showing results for - "how to make popupwindow background blur in android"
Fynn
04 Apr 2017
1PopupWindow popup = new PopupWindow(contentView, width, height);
2popup.setBackgroundDrawable(background);
3popup.showAsDropDown(anchor);
4
5View container = (View) popup.getContentView().getParent();
6WindowManager wm = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
7WindowManager.LayoutParams p = (WindowManager.LayoutParams) container.getLayoutParams();
8// add flag
9p.flags |= WindowManager.LayoutParams.FLAG_DIM_BEHIND;
10p.dimAmount = 0.3f;
11wm.updateViewLayout(container, p);
12