Android设备的默认横屏是顺时针90度,如何修改顺时针270度,即是逆时针90度。
1.系统全局修改(涉及源码)
1.查看相关逻辑,可以看到有个布尔值com.android.internal.R.bool.config_reverseDefaultRotation控制翻转:
frameworks/base/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@Override
public void setInitialDisplaySize(Display display, int width, int height, int density) {
// This method might be called before the policy has been fully initialized
// or for other displays we don't care about.
if (mContext == null || display.getDisplayId() != Display.DEFAULT_DISPLAY) {
return;
}
mDisplay = display;
final Resources res = mContext.getResources();
int shortSize, longSize;
if (width > height) {
shortSize = height;
longSize = width;
mLandscapeRotation = Surface.ROTA