- 注册时间
- 2013-4-19
- 最后登录
- 2024-9-26
- 阅读权限
- 200
- 积分
- 6404
- 精华
- 0
- 帖子
- 640
|
由于是pad需要把虚拟按键放在屏幕的左侧 并且增加宽度(其实系统判断中是有放在右侧的,但是左侧时没有的需要自己修改一些计算)
PhoneWindowManager.java中 mNavigationBarHeightForRotation 这个数据里面存储的时宽度(横屏时)
横屏时,虚拟按键宽度,core/res/res/values/dimens.xml 中<dimen name="navigation_bar_width">42dp</dimen>
水平时导航栏默认是在右面的,在beginLayoutLw函数里面判断根据mNavinationBarCanMove和 displayWidth < displayHeight 来判断是否显示在右面
通过修改计算,让导航栏变到左面
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -281,7 +281,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
WindowState mNavigationBar = null;
boolean mHasNavigationBar = false;
boolean mCanHideNavigationBar = false;
- boolean mNavigationBarCanMove = false; // can the navigation bar ever move to the side?
+ boolean mNavigationBarCanMove = true; // can the navigation bar ever move to the side?
boolean mNavigationBarOnBottom = true; // is the navigation bar on the bottom *right now*?
int[] mNavigationBarHeightForRotation = new int[4];
int[] mNavigationBarWidthForRotation = new int[4];
@@ -1188,10 +1188,10 @@ resolver.registerContentObserver(Settings.System.getUriFor(
int longSizeDp = longSize * DisplayMetrics.DENSITY_DEFAULT / density;
// Allow the navigation bar to move on small devices (phones).
- mNavigationBarCanMove = shortSizeDp < 600;
- if(mHdmiPlugged){
- mNavigationBarCanMove = false;
- }
+ //mNavigationBarCanMove = shortSizeDp < 600;
+ //if(mHdmiPlugged){
+ // mNavigationBarCanMove = false;
+ //}
mHasNavigationBar = res.getBoolean(com.android.internal.R.bool.config_showNavigationBar);
// Allow a system property to override this. Used by the emulator.
@@ -1213,7 +1213,7 @@ resolver.registerContentObserver(Settings.System.getUriFor(
if(SystemProperties.getBoolean("ro.platform.has.mbxuimode",false)){
- mNavigationBarCanMove = false;
+ //mNavigationBarCanMove = false;
mCanHideNavigationBar = true;
}
@@ -2843,12 +2843,12 @@ resolver.registerContentObserver(Settings.System.getUriFor(
break;
}
} else {
- overscanLeft = 0;
+ overscanLeft = mNavigationBarWidthForRotation[displayRotation];
overscanTop = 0;
overscanRight = 0;
overscanBottom = 0;
}
- mOverscanScreenLeft = mRestrictedOverscanScreenLeft = 0;
+ mOverscanScreenLeft = mRestrictedOverscanScreenLeft = mNavigationBarWidthForRotation[displayRotation];
mOverscanScreenTop = mRestrictedOverscanScreenTop = 0;
mOverscanScreenWidth = mRestrictedOverscanScreenWidth = displayWidth;
mOverscanScreenHeight = mRestrictedOverscanScreenHeight = displayHeight;
@@ -2865,7 +2865,7 @@ resolver.registerContentObserver(Settings.System.getUriFor(
mRestrictedScreenWidth = mSystemGestures.screenWidth = mUnrestrictedScreenWidth;
mRestrictedScreenHeight = mSystemGestures.screenHeight = mUnrestrictedScreenHeight;
mDockLeft = mContentLeft = mStableLeft = mStableFullscreenLeft
- = mCurLeft = mUnrestrictedScreenLeft;
+ = mCurLeft = mUnrestrictedScreenLeft = mNavigationBarWidthForRotation[displayRotation];
mDockTop = mContentTop = mStableTop = mStableFullscreenTop
= mCurTop = mUnrestrictedScreenTop;
mDockRight = mContentRight = mStableRight = mStableFullscreenRight
@@ -2978,13 +2978,13 @@ resolver.registerContentObserver(Settings.System.getUriFor(
// Landscape screen; nav bar goes to the right.
int left = displayWidth - overscanRight
- mNavigationBarWidthForRotation[displayRotation];
- mTmpNavigationFrame.set(left, 0, displayWidth - overscanRight, displayHeight);
- mStableRight = mStableFullscreenRight = mTmpNavigationFrame.left;
+ mTmpNavigationFrame.set(0, 0, mNavigationBarWidthForRotation[displayRotation], displayHeight);
+ mStableRight = mStableFullscreenRight = displayWidth;
if (transientNavBarShowing) {
mNavigationBarController.setBarShowingLw(true);
} else if (navVisible) {
mNavigationBarController.setBarShowingLw(true);
- mDockRight = mTmpNavigationFrame.left;
+ mDockRight = displayWidth;
mRestrictedScreenWidth = mDockRight - mRestrictedScreenLeft;
mRestrictedOverscanScreenWidth = mDockRight - mRestrictedOverscanScreenLeft;
} else {
@@ -2996,7 +2996,7 @@ resolver.registerContentObserver(Settings.System.getUriFor(
// If the nav bar is currently requested to be visible,
// and not in the process of animating on or off, then
// we can tell the app that it is covered by it.
- mSystemRight = mTmpNavigationFrame.left;
+ mSystemRight = displayWidth;
}
}
屏幕最上面 有wifi图标和时间那个地方时状态栏status_bar.xml
wifi 3g 信号这个图标是通过<include layout="@layout/signal_cluster_view" 引到状态栏的布局里面
在PhoneStatusBar.java中通过
mNetworkController.addSignalCluster(signalCluster); 和 controller和signaliew关联起来的
|
|