我想使它成为我的应用程序永远不会进入肖像模式,但能够在2个横向屏幕视图之间切换。我知道这很容易在姜饼(2.3)来完成,但我有麻烦做手工为Android的其他版本,我的代码如下:使用Display.getRotation()的屏幕旋转
Display display = ((WindowManager) getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
int orientation = display.getRotation();
if (orientation == 1) {
/* The device is rotated to the left. */
Log.v("Left", "Rotated Left");
} else if (orientation == 3) {
/* The device is rotated to the right. */
Log.v("Right", "Rotated Right");
} else {
}
我的问题是我怎么翻转X和屏幕视图的y轴取决于检测到的旋转?我如何获得它们以扭转它们?
必须有办法手动设置x轴和y轴? android操作系统如何知道自己做它? – SamRowley 2011-01-21 10:40:29