Chinaunix首页 | 论坛 | 博客
  • 博客访问: 811214
  • 博文数量: 210
  • 博客积分: 10002
  • 博客等级: 上将
  • 技术积分: 1840
  • 用 户 组: 普通用户
  • 注册时间: 2008-11-18 09:56
文章分类

全部博文(210)

文章存档

2011年(1)

2010年(6)

2009年(65)

2008年(138)

我的朋友

分类: LINUX

2008-11-24 16:03:37

通过手动的方式:
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 Sad ).
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();
阅读(1531) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~