I'm creating a component that needs to appear above and separate from the existing UI, like sliding in from the bottom of the screen and staying anchored there, regardless of the current contentview. I'd like it to be modular and portable, so pre-supposing a FrameLayout isn't realistic.
In looking at the source for the Dialog and PopupWindow classes, it looks like they accomplish this using the Window and WindowManager classes, but I'm not able to find much in the way of documentation on these classes.
Is there a simple way to accomplish what I'm describing?
TYIA
For the benefit of future searchers: the answer is to use the WindowManager class. It's pretty straightforward, despite the lack of documentation (that I could find, anyway):
WindowManager.LayoutParams wlp = new WindowManager.LayoutParams();
// assign position, dimensions, and layout behavior as properties of wlp
WindowManager wm = (WindowManager) getSystemService("window");
wm.addView(someView, wlp);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With