Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- val popup = PopupWindow(...)
- val container = popup.contentView.takeIf { it.layoutParams is WindowManager.LayoutParams }
- ?: (popup.contentView.parent as? View)?.takeIf { it.layoutParams is WindowManager.LayoutParams }
- ?: (popup.contentView.parent.parent as? View)?.takeIf { it.layoutParams is WindowManager.LayoutParams }
- ?: throw IllegalStateException("NO WindowManager.LayoutParams!")
- val wm = context.getSystemService(Context.WINDOW_SERVICE) as WindowManager
- val lp = container.layoutParams as WindowManager.LayoutParams
- lp.flags = lp.flags or WindowManager.LayoutParams.FLAG_DIM_BEHIND
- lp.dimAmount = 0.3f
- wm.updateViewLayout(container, lp)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement