① navigationbar横屏底部显示
源码路径: framework/base/services/core/java/come/android/server/policy/PhoneWindowManager.java
mtk8.1 作如下修改:
mNavigationBarPosition = navigationBarPosition(displayWidth,displayHeight,displayRotation);
private int navigationBarPosition(int displayWidth,int displayHeight,int displayRotation){
/* if(mNavigationBarCanMove && displayWidth>displayHeight){
if(displayRotation == Surface.ROTATION_270){
return NAV_BAR_LEFT;
}else{
return NAN_BAR_REGHT;
}
} */
return NAV_BAR_BOTTOM;
}
mtk 6.0作如下修改
// mNavigationBarOnBottom = (!mNavigationBarCanMove || displayWidth < displayHeight);
mNavigationBarOnBottom = true;
如果不可以的话,在修改
源码路径: frameworks\base\packages\SystemUI\src\com\android\systemui\statusbar\phone\NavigationBarView.java
//mRotatedViews[Surface.ROTATION_90] = findViewById(R.id.rot90);
mRotatedViews[Surface.ROTATION_90] = findViewById(R.id.rot0);
其实,8.1就是把mNavigationBar !=null那段相关代码另写成一个方法navigationBarPosition(…)
② 不显示navigationbar
源码路径:在device目录下的system.prop文件中
# temporary enables NAV bar (soft keys)
qemu.hw.mainkeys=0
源码路径: framework/base/services/core/java/come/android/server/policy/PhoneWindowManager.java
mHasNavigationBar = res.getBoolean(com.android.R.bool.config_showMavigationBar);
// Allow a system property to override this. Used by emulator.
// See also hasNavigationBar().
String navBarOverride = SystemProperties.get("qemu.hw.mainkeys);
if("1".equals(navBarOverride )){
mHasNavigationBar = false;
}els if("0".equals(navBarOverride )){
mHasNavigationBar = true;
}
qemu.hw.mainkeys=0存在,qemu.hw.mainkeys=1不存在