最近同事说需要修改右边导航栏到底部,问怎么搞?然后看下源码尝试下。
1、Android 12修改代码路径 frameworks/base/services/core/java/com/android/server/wm/DisplayPolicy.java
a/frameworks/base/services/core/java/com/android/server/wm/DisplayPolicy.java b/frameworks/base/services/core/java/com/android/server/wm/DisplayPolicy.java
old mode 100644 (file)
new mode 100755 (executable)
index b4227f8..a11be51
--- a/frameworks/base/services/core/java/com/android/server/wm/DisplayPolicy.java
+++ b/frameworks/base/services/core/java/com/android/server/wm/DisplayPolicy.java
@@ -3270,13 +3270,13 @@ public class DisplayPolicy extends AbsDisplayPolicy{
@NavigationBarPosition
int navigationBarPosition(int displayWidth, int displayHeight, int displayRotation) {
- if (navigationBarCanMove() && displayWidth > displayHeight) {
+ /*if (navigationBarCanMove() && displayWidth > displayHeight) {
if (displayRotation == Surface.ROTATION_270) {
Log.e("DisplayPolicy","ZM NAV_BAR_LEFT displayRotation ="+displayRotation);
return NAV_BAR_LEFT;
} else if (displayRotation == Surface.ROTATION_90) {
return NAV_BAR_RIGHT;
Log.e("DisplayPolicy","ZM NAV_BAR_RIGHT displayRotation ="+displayRotation);
}
- }
+ }*/
return NAV_BAR_BOTTOM;
}
2、修改之后效果显示如图所示 ,基本跟屏幕密度比density 有关。
这里简单记录下,转载请注明出处高通Android 12 右边导航栏改成底部显示-CSDN博客,谢谢!