修改Android屏幕默认旋转方向
16lz
2021-01-24
- su
- sqlite3 /data/data/com.android.providers.settings/databases/settings.db
- insert into system (name,value) values('accelerometer_rotation',0);
- insert into system (name,value) values('user_rotation',1);
- .exit
- user_rotation 0 -> ROTATION_0
- user_rotation 1 -> ROTATION_180
- user_rotation 2 -> ROTATION_270
- user_rotation 3 -> ROTATION_90
- public void disableAccelerometerRotation(){
- try {
- Settings.System.putInt(mcontext.getContentResolver(),Settings.System. ACCELEROMETER_ROTATION,0);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- public void setScreenRotation(String rotationStr){
- int rotation = 0;// Surface.ROTATION_90;
- if(rotationStr.equals("0" )){
- rotation = Surface. ROTATION_0;
- } else if (rotationStr.equals("90")){
- rotation = Surface. ROTATION_90;
- } else if (rotationStr.equals("180")){
- rotation = Surface. ROTATION_180;
- } else if (rotationStr.equals("270")){
- rotation = Surface. ROTATION_270;
- }
- Settings.System. putInt(mcontext.getContentResolver(),Settings.System. USER_ROTATION,rotation);
- }
更多相关文章
- Fix bug in the notepad tutorial of Android
- Android(安卓)-- 点击双下返回退出程序
- android BOOT_COMPLETED 失败
- 反编译Android部署程序
- Android(安卓)系统应用调用,intent的使用总结帖
- Android(安卓)URI简单介绍
- android 系统开发 学习方向
- Google Play 商店删除百度的两个Android应用程序
- Android应用程序进程启动源码解析