Reputation: 1284
Could I force changing the view's orientation in order to test how the layout appears or it is not possible to test this behavior on virtual device.
Under forcing it, I mean for example on click event to change from one to another screen orientation and inverse.
Upvotes: 2
Views: 1387
Reputation: 681
Ctrl+F11
will switch the screen orientation, but when it come to coding the orientation to change you have a couple of options:
Activity
to be a given orientation. Which is useful when you want to force the user to use a specific orientation only.Activity
to allow either orientation and let the user decide.Each of these is useful in their own scenarios. For example, viewing a graph that will only be useful in landscape should be hardcoded, but scrolling through a list could allow a user to pick which was more comfortable for them.
How to set the mode:
Activity
you want to edit and set the Screen Orientation
directly.AndroidManifest.xml
:
<activity android:screenOrientation="[fill in preference here]" />
Activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_[type])
Activity.getRequestedOrientation()
An explanation of the different modes can be found here: Screen Orientation Types | Activity
So, if you want to force a change on a screen based on user input, you can all you need to do is set the orientation type in code.
Upvotes: 3
Reputation: 54322
Did you try Ctrl+F11
keyboard shortcut or as the user dragon112 has suggested you can go for numpad key "7" with numlock "on".
Upvotes: 2
Reputation: 10303
This is done with the HOME(7) button on the num pad (num lock needs to be disabled i beleve, not sure tho).
Upvotes: 2