I have a WebView that I would like to expand to fullscreen. The user will interact with it, so it needs to maintain some sort of state when it expands. The ideal process is this:
- Remove WebView from its parent
- Put WebView at the top of the current View hierarchy with `FILL_PARENT` for width and height
Later, I will need the put the WebView back:
- Remove WebView from top of the hierarchy
- Restore the old hierarchy
- Put WebView back where it was with its previous setting for width and height
I know about getRootView
, but I don't know how to use it. What's a DecorView
?
If anyone has some sample code to accomplish the expanding and collapsing behavior I've described above, I'd be really grateful. Thanks!
Get the root view of the
DecorView
:Remove that root view:
Remove the
WebView
from its parent:Put the
WebView
at the top of the view hierarchy:Use your
rootview
reference to undo the expansion.The only thing is: I don't know how you're going to restore the layout parameters for
rootview
.