1. 先判断是否打开:  
  2.  int flag =Settings.System.getInt(context.getContentResolver(),Settings.System.ACCELEROMETER_ROTATION, 0);  
  3.  打开关闭,关闭打开:  1开启   0关闭
  4.  Settings.System.putInt(context.getContentResolver(),Settings.System.ACCELEROMETER_ROTATION,flag==1?0:1); 

相关文章: