通过手动的方式:
CTRL+F12,
eclipse 里面run dialog->target 里面可以设置.如果是命令行可以使用参数
emulator -skin HVGA-L
Rotate Screen from Code
What you learn: You will learn how to rotate the screen (change screen orientation) using code.
[Update]
zhobbs wrote: |
Thanks for the tip plusminus, looks like it changed in 0.9:
Java: |
Activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_*); | and
Java: |
Activity.getRequestedOrientation(); | Thanks! |
[/Update]
(Just found this code snippet in my ICQ-Log):
Java: |
android.view.IWindowManager windowService = android.view.IWindowManager.Stub.asInterface(ServiceManager.getService("window")); windowService.setOrientation(1); |
If I remember right, it is 0-3 for all 4 possible screen-rotations (could not find official constants for it ).
The orientation is even "remembered" if you leave your app to the HOME-Screen.
This is how to get the current Screen-Orientation:
Java: |
windowService.getOrientation(); |
阅读(1574) | 评论(0) | 转发(0) |