Monday, 2 September 2013

Forcing WebView or PopupWindow orientation regardless of device orientation

Forcing WebView or PopupWindow orientation regardless of device orientation

I have an application that opens a WebView inside a PopupWindow on push of
a button. I'd like to lock the WebView to a specific orientation (e.g.
portrait), and have it display content in that orientation regardless of
the orientation of the underlying activity.
I tried changing the orientation on the activity to the wanted
orientation, but doing so restarts the activity and confuses the
PopupWindow (which is held i the background, waiting to be opened).
Is there a way to set the orientation of either the PopupWindow or WebView
without changing the orientation of the activity, or maybe change the
orientation of the activity without restarting?
(Note: the only classes I can edit are the WebView, PopupWindow and a
controller class, I'd like to leave the activity's code unchanged.)

No comments:

Post a Comment