Each popupwindow has a view, put View.setalpha (0.5f);
Public classCustomactionproviderextendsActionproviderImplementsOnmenuitemclicklistener, Onclicklistener, Ontouchlistener, Onkeylistener {Private FinalContext context;//Context PrivateView Actionview;//Action View PrivatePopupwindow Mpopupwindow;//There's a view,view in the popup window that looks like a menu. PrivateView Mmenu;//display controls in the popup window Private voidInitpopupmenu () {layoutinflater Lif=Layoutinflater.from (context); Mmenu= Lif.inflate (R.layout.custom_popup_window,NULL); mmenu.setalpha (0 . 5f); Mpopupwindow=NewPopupwindow (Mmenu, WindowManager.LayoutParams.WRAP_CONTENT, Windowmanager.layoutparams. Wrap_content); /** Setbackgrounddrawable is very important, without this function the back key and the menu key to close Popwindow is troublesome, * after it, you do not have to set the control for Popwindow in the Setonkeyli Stener and Setontouchlistener * can support both back return and point Popwindow outside of the close Popwindow,*/mpopupwindow.setbackgrounddrawable (NewColordrawable (0x00000)); }
//...}
Popupwindow (4) Translucent Popupwindow