更改android锁屏方向
来源:互联网 发布:如何修改路由器mac地址 编辑:程序博客网 时间:2024/03/29 00:42
更改android默认屏幕方向 - [技术]
2011-12-11
版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明
http://glizardy.blogbus.com/logs/180916299.html
frameworks/policies/base/phone/com/android/internal/policy/impl/PhoneWindowManager.java function: rotationForOrientationLw return a direction of what you want; *the red lines are my change: (in eclair)* */*added by wylhistory for test*/* * Log.d(TAG,"the before switch orientation :"+orientation);* * if(false){* * /*above is added by wylhistory for test*/* synchronized (mLock) { switch (orientation) { case ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE: //always return landscape if orientation set to landscape return mLandscapeRotation; case ActivityInfo.SCREEN_ORIENTATION_PORTRAIT: //always return portrait if orientation set to portrait return mPortraitRotation; } // case for nosensor meaning ignore sensor and consider only lid // or orientation sensor disabled //or case.unspecified if (mLidOpen) { return mLidOpenRotation; } else if (mDockState == Intent.EXTRA_DOCK_STATE_CAR && mCarDockRotation >= 0) { return mCarDockRotation; } else if (mDockState == Intent.EXTRA_DOCK_STATE_DESK && mDeskDockRotation > = 0) { return mDeskDockRotation; } else { if (useSensorForOrientationLp(orientation)) { // If the user has enabled auto rotation by default, do it. int curRotation = mOrientationListener.getCurrentRotation(); return curRotation >= 0 ? curRotation : lastRotation; } return Surface.ROTATION_0; } } */*added by wylhistory for test*/* * ** }* * return Surface.ROTATION_90;/here you can change to any other direction of your like;* * /*added by wylhistory */* *
此方法可以修改初始方向。
另外可修改package/apps/launcher2/AndroidManifest.xml
android:screenOrientation
此方法无法更改初始锁屏界面的方向。
synchronized (mLock) {
switch (orientation) {
case ActivityInfo.SCREEN_ORIENTATION_PORTRAIT:
boolean isConnected = isHdmiConnected(HdmiState);
if (isConnected){
return mLandscapeRotation;
}else
{
return mPortraitRotation;
}
//always return portrait if orientation set to portrait
case ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE:
//always return landscape if orientation set to landscape
return mLandscapeRotation;
case ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT:
//always return portrait if orientation set to portrait
return mUpsideDownRotation;
case ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE:
//always return seascape if orientation set to reverse landscape
return mSeascapeRotation;
case ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE:
//return either landscape rotation based on the sensor
mOrientationListener.setAllow180Rotation(false);
return getCurrentLandscapeRotation(lastRotation);
case ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT:
mOrientationListener.setAllow180Rotation(true);
return getCurrentPortraitRotation(lastRotation);
}
mOrientationListener.setAllow180Rotation(
orientation == ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR);
// case for nosensor meaning ignore sensor and consider only lid
// or orientation sensor disabled
//or case.unspecified
if (mLidOpen) {
return mLidOpenRotation;
} else if (mDockMode == Intent.EXTRA_DOCK_STATE_CAR && mCarDockRotation >= 0) {
return mCarDockRotation;
} else if (mDockMode == Intent.EXTRA_DOCK_STATE_DESK && mDeskDockRotation >= 0) {
return mDeskDockRotation;
} else {
if (useSensorForOrientationLp(orientation)) {
return mOrientationListener.getCurrentRotation(lastRotation);
}
if (SystemProperties.get("ro.sf.hwrotation").equals("270")) {
//Log.d("------->xzj","ro.sf.hwrotation is set ,care");
return Surface.ROTATION_90;
}
return Surface.ROTATION_0; // can change lockscreen rotation
}
}
}
- 更改android锁屏方向
- 动态更改Android的屏幕方向
- Android入门笔记之更改手机屏幕方向
- 动态更改屏幕方向
- 单击Button 更改屏幕方向
- Android 基础教程之---动态更改屏幕方向的简单例子(LANDSCAPE与PORTRAIT)!
- Android 基础教程之---动态更改屏幕方向的简单例子(LANDSCAPE与PORTRAIT)!
- Android 基础教程之---动态更改屏幕方向的简单例子(LANDSCAPE与PORTRAIT)!
- Android 基础教程之---动态更改屏幕方向的简单例子(LANDSCAPE与PORTRAIT)!
- Cocos2d-x Android修改ICON名字、更改图标、修改屏幕方向、修改版本号
- Android 基础教程之---动态更改屏幕方向的简单例子(LANDSCAPE与PORTRAIT)!
- Android 禁止屏幕旋转 & 屏幕旋转不刷新 Activity & 动态更改屏幕方向
- ubuntu更改鼠标滚轮方向为自然方向(运动方向和滚轮滚动方向一致)
- matlab实现不同方向颜色更改
- maya中查看法线方向并更改
- ios编程:xcode如何更改屏幕方向
- C# Word中设置/更改文本方向
- 更改Windows鼠标滑轮滚动方向
- android屏幕适配不同的资源图片、布局
- C++的四种cast操作符的区别--类型转换
- Tomcat 配置Manager用户名与密码
- 怎么会有这样的代码
- 使用Spinner和setDropDownViewResource
- 更改android锁屏方向
- 一个shell文件的分析记录
- 大家这么热情,我就献丑了 -- 我的iPhone软件
- linux2.6.36文件系统分析---sys_mount()
- 通过PHP控制缓冲区来实现的应用
- 复习啦
- xcode4.2手动添加MainWindow.xib
- itest Tutorial
- 打开ppp packet打印