Android 打开屏幕旋转
生活随笔
收集整理的這篇文章主要介紹了
Android 打开屏幕旋转
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
2019獨角獸企業(yè)重金招聘Python工程師標(biāo)準(zhǔn)>>>
添加設(shè)置讀寫權(quán)限:
<uses-permission android:name="android.permission.WRITE_SETTINGS"/>判斷是否屏幕旋轉(zhuǎn)被關(guān)閉,如果關(guān)閉則打開:
// 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);?
轉(zhuǎn)載于:https://my.oschina.net/u/165872/blog/110449
總結(jié)
以上是生活随笔為你收集整理的Android 打开屏幕旋转的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: create maven android
- 下一篇: request.getcontextPa