getRotation在Android中始终返回0

时间:2012-02-13 15:57:57

标签: android android-sensors

我试图像Android一样在Android中获取轮播:

Display display = ((WindowManager)
           context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
int rotation = display.getRotation();

但旋转始终为0,尽管我在四个可用位置旋转手机。

我错过了什么吗? 我正在使用真正的手机(三星Galaxy S2)。

1 个答案:

答案 0 :(得分:0)

我不知道如果屏幕被锁定,则不计算旋转,我会尝试创建一个WAKE_LOCK。 谢谢!吉列尔莫。