栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

Android 10 导航栏按钮图标点击范围过大

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Android 10 导航栏按钮图标点击范围过大

diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
index 421a58f..96b7967 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
@@ -109,6 +109,8 @@ public class NavigationBarView extends FrameLayout implements
     private Rect mBackButtonBounds = new Rect();
     private Rect mRecentsButtonBounds = new Rect();
     private Rect mRotationButtonBounds = new Rect();
+    private Rect mVolumeAddButtonBounds = new Rect();
+    private Rect mVolumeSubButtonBounds = new Rect();
     private final Region mActiveRegion = new Region();
     private int[] mTmpPosition = new int[2];
 
@@ -878,6 +880,8 @@ public class NavigationBarView extends FrameLayout implements
         updateButtonLocation(getBackButton(), mBackButtonBounds, true);
         updateButtonLocation(getHomeButton(), mHomeButtonBounds, false);
         updateButtonLocation(getRecentsButton(), mRecentsButtonBounds, false);
+        updateButtonLocation(getVolumeAddButton(), mVolumeAddButtonBounds, false);
+        updateButtonLocation(getVolumeSubButton(), mVolumeSubButtonBounds, false);
         updateButtonLocation(getRotateSuggestionButton(), mRotationButtonBounds, true);
         // TODO: Handle button visibility changes
         mOverviewProxyService.onActiveNavBarRegionChanges(mActiveRegion);
@@ -924,6 +928,13 @@ public class NavigationBarView extends FrameLayout implements
     }
 
     private void updateCurrentView() {
+        if (mCurrentRotation == Surface.ROTATION_0
+                || mCurrentRotation == Surface.ROTATION_180) {
+            setPadding(650, 0, 650, 0);
+        } else if (mCurrentRotation == Surface.ROTATION_90
+                || mCurrentRotation == Surface.ROTATION_270) {
+            setPadding(230, 0, 230, 0);
+        }
         resetViews();
         mCurrentView = mIsVertical ? mVertical : mHorizontal;
         mCurrentView.setVisibility(View.VISIBLE);
@@ -1173,8 +1184,17 @@ public class NavigationBarView extends FrameLayout implements
     public WindowInsets onApplyWindowInsets(WindowInsets insets) {
         int leftInset = insets.getSystemWindowInsetLeft();
         int rightInset = insets.getSystemWindowInsetRight();
-        setPadding(leftInset, insets.getSystemWindowInsetTop(), rightInset,
-                insets.getSystemWindowInsetBottom());
+//        setPadding(leftInset, insets.getSystemWindowInsetTop(), rightInset,
+//                insets.getSystemWindowInsetBottom());
+        if (mCurrentRotation == Surface.ROTATION_0
+                || mCurrentRotation == Surface.ROTATION_180) {
+            setPadding(650, insets.getSystemWindowInsetTop(), 650,
+                    insets.getSystemWindowInsetBottom());
+        } else if (mCurrentRotation == Surface.ROTATION_90
+                || mCurrentRotation == Surface.ROTATION_270) {
+            setPadding(230, insets.getSystemWindowInsetTop(), 230,
+                    insets.getSystemWindowInsetBottom());
+        }
         // we're passing the insets onto the gesture handler since the back arrow is only
         // conditionally added and doesn't always get all the insets.
         mEdgeBackGestureHandler.setInsets(leftInset, rightInset);

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/1000429.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号