Suppose that within an activity my initial screen orientation is landscape. In the开发者_如何学运维 same activity, I would like to add a button which changes the screen orientation from landscape to portrait.
Is this possible in any way, or should I switch to a new activity ?
Thanks.
Use Activity.setRequestedOrientation() method
you can add new views to your layout, but first you need to detect the orientation change which is explained in the following link how it's done.
How to detect orientation change in layout in Android?
hope this helps
精彩评论