在Android中使用"USER_ROTATION"API低于11(解决方法?)

Sag*_*Low 15 android rotation

在我的应用程序中,我使用以下命令:

Settings.System.putInt(getContentResolver(), Settings.System.USER_ROTATION, m_lockedInOrientation)
Run Code Online (Sandbox Code Playgroud)

正如Android网站中所提到的,当android找不到时,这将设置默认方向.:

没有其他策略适用时的默认屏幕旋转.当ACCELEROMETER_ROTATION为零并且没有屏幕上的活动表达首选项时,将使用此轮换值.

目前这是我的应用程序不能在Android 2.X上工作但只有3.X +的唯一原因.
有没有人知道一种解决方法呢?

小智 0

 //vetical position
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); // Make to run your application only in portrait mode
  //HORIZONDEL setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SCREEN_ORIENTATION_LANDSCAPE);
Run Code Online (Sandbox Code Playgroud)

  • 请提供更多解释 (2认同)