Android 打开屏幕旋转
生活随笔
收集整理的這篇文章主要介紹了
Android 打开屏幕旋转
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
2019獨角獸企業重金招聘Python工程師標準>>>
添加設置讀寫權限:
<uses-permission android:name="android.permission.WRITE_SETTINGS"/>判斷是否屏幕旋轉被關閉,如果關閉則打開:
// check whether the screen rotation worksint flag = Settings.System.getInt(getContentResolver(),Settings.System.ACCELEROMETER_ROTATION, 0);if (0 == flag) {// open screen rotation and give user infomation alertToast.makeText(getApplicationContext(), "open screen rotation",Toast.LENGTH_LONG).show();Settings.System.putInt(getContentResolver(),Settings.System.ACCELEROMETER_ROTATION, 1);?
轉載于:https://my.oschina.net/u/165872/blog/110449
總結
以上是生活随笔為你收集整理的Android 打开屏幕旋转的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: create maven android
- 下一篇: request.getcontextPa