Android9.0 SystemUI下拉框宽度不够,图标超出界面,通知栏一直在最中间显示,导致和下拉框错位。

Android 下拉框 Android下拉框光标错位_android

修改如下:

From 87db3096fffafd161a0c8a60ccf73b33055e8898 Mon Sep 17 00:00:00 2001
From: adminroot <2969513202@qq.com>
Date: Mon, 11 Apr 2022 15:40:29 +0800
Subject: [PATCH] 1.Fix systemUI QSTitle show issue 2.Fix notification show
 issue

---
 packages/SystemUI/res/values-land/dimens.xml  |  2 +-
 .../phone/NotificationPanelView.java          | 40 +++++++++++++++----
 2 files changed, 33 insertions(+), 9 deletions(-)
 mode change 100644 => 100755 packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java

diff --git a/packages/SystemUI/res/values-land/dimens.xml b/packages/SystemUI/res/values-land/dimens.xml
index c59dbdc3215..59b076e92b9 100644
--- a/packages/SystemUI/res/values-land/dimens.xml
+++ b/packages/SystemUI/res/values-land/dimens.xml
@@ -25,7 +25,7 @@
     <dimen name="brightness_mirror_height">40dp</dimen>
 
     <!-- Width for the spacer, used between QS tiles. -->
-    <dimen name="qs_quick_tile_space_width">38dp</dimen>
+    <dimen name="qs_quick_tile_space_width">0dp</dimen>
     <dimen name="qs_tile_margin_top">2dp</dimen>
     <dimen name="qs_header_tooltip_height">24dp</dimen>
 
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
old mode 100644
new mode 100755
index 2f18aad9612..f5b65da4e88
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -2480,17 +2480,39 @@ public class NotificationPanelView extends PanelView implements
             x = getWidth() / 2;
         }
         x = Math.min(rightMost, Math.max(leftMost, x));
-        setVerticalPanelTranslation(x -
+        /*setVerticalPanelTranslation(x -
+                (mNotificationStackScroller.getLeft() + mNotificationStackScroller.getWidth() / 2));*/
+		int translation = (int)(x -
                 (mNotificationStackScroller.getLeft() + mNotificationStackScroller.getWidth() / 2));
+        int translationMost = getWidth() / 2 - mPositionMinSideMargin - mNotificationStackScroller.getWidth() / 2;
+        if (DEBUG) {
+            Log.d("NotificationPanelView","translation " + translation);
+            Log.d("NotificationPanelView","translationMost " + translationMost);
+            Log.d("NotificationPanelView","getWidth() " + getWidth());
+            Log.d("NotificationPanelView","mPositionMinSideMargin " + mPositionMinSideMargin);
+            Log.d("NotificationPanelView","mNotificationStackScroller.getWidth() " + mNotificationStackScroller.getWidth());
+        }
+        if(translation > translationMost){
+            translation = translationMost;
+        }else if(translation < -translationMost){
+            translation = -translationMost;
+        }
+        setVerticalPanelTranslation(translation);
      }
 
     private void resetVerticalPanelPosition() {
-        setVerticalPanelTranslation(0f);
+        setVerticalPanelTranslation(0);
     }

-    protected void setVerticalPanelTranslation(float translation) {
-        mNotificationStackScroller.setTranslationX(translation);
-        mQsFrame.setTranslationX(translation);
+    }
+
+    protected void setVerticalPanelTranslation(int translation) {
+        //mNotificationStackScroller.setTranslationX(translation);
+        //mQsFrame.setTranslationX(translation);
+		FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mNotificationStackScroller.getLayoutParams();
+        lp.leftMargin = translation;
+        mNotificationStackScroller.setLayoutParams(lp);
+        lp = (FrameLayout.LayoutParams) mQsFrame.getLayoutParams();
+        lp.leftMargin = translation;
+        mQsFrame.setLayoutParams(lp);
         int size = mVerticalTranslationListener.size();
         for (int i = 0; i < size; i++) {
             mVerticalTranslationListener.get(i).run();
@@ -2515,7 +2537,9 @@ public class NotificationPanelView extends PanelView implements
     }

修改后

Android 下拉框 Android下拉框光标错位_java_02