1. 程式人生 > >android 開啟自動旋轉螢幕的實現程式碼

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"/>許可權