android 开启自动旋转屏幕

//0为关闭 1为开启
Settings.System.putInt(getContentResolver(),Settings.System.ACCELEROMETER_ROTATION, 1);
//得到是否开启
int flag = Settings.System.getInt(getContentResolver(),
			Settings.System.ACCELEROMETER_ROTATION, 0);

需要添加<uses-permission android:name="android.permission.WRITE_SETTINGS"/>权限

你可能感兴趣的:(android,开启自动旋转屏幕)