Android系统定制--Launcher

修改图标和文字间的间隔

修改文件:packages\apps\Launcher3\src\co\android\launcher3\BubbleTextView.java

 int defaultIconSize = grid.iconSizePx;
         if (display == DISPLAY_WORKSPACE) {
             setTextSize(TypedValue.COMPLEX_UNIT_PX, grid.iconTextSizePx);
-            setCompoundDrawablePadding(grid.iconDrawablePaddingPx);
+            setCompoundDrawablePadding(0);
         } else if (display == DISPLAY_ALL_APPS) {
             setTextSize(TypedValue.COMPLEX_UNIT_PX, grid.allAppsIconTextSizePx);
-            setCompoundDrawablePadding(grid.allAppsIconDrawablePaddingPx);
+            setCompoundDrawablePadding(0);
             defaultIconSize = grid.allAppsIconSizePx;
         } else if (display == DISPLAY_FOLDER) {
             setTextSize(TypedValue.COMPLEX_UNIT_PX, grid.folderChildTextSizePx);
-            setCompoundDrawablePadding(grid.folderChildDrawablePaddingPx);
+            setCompoundDrawablePadding(0);
             defaultIconSize = grid.folderChildIconSizePx;
         }
         mCenterVertically = a.getBoolean(R.styleable.BubbleTextView_centerVertically, false);
修改cellHeightPx的高度

修改文件:packages/apps/Launcher3/src/com/android/launcher3/DeviceProfile.java

  iconDrawablePaddingPx = (int) (iconDrawablePaddingOriginalPx * scale);
 
         cellHeightPx = iconSizePx + iconDrawablePaddingPx
-                + Utilities.calculateTextHeight(iconTextSizePx);
+                + Utilities.calculateTextHeight(iconTextSizePx)+10;
         int cellYPadding = (getCellSize().y - cellHeightPx) / 2;
         if (iconDrawablePaddingPx > cellYPadding && !isVerticalLayout
                 && !isMultiWindowMode) {
Launcher横屏后不显示应用名
diff --git a/packages/apps/Launcher3/src/com/android/launcher3/DeviceProfile.java b/packages/apps/Launcher3/src/com/android/launcher3/DeviceProfile.java
old mode 100644
new mode 100755
index ce32dc8..a099156
--- a/packages/apps/Launcher3/src/com/android/launcher3/DeviceProfile.java
+++ b/packages/apps/Launcher3/src/com/android/launcher3/DeviceProfile.java
@@ -132,6 +132,7 @@ public class DeviceProfile {
     private final Rect mHotseatPadding = new Rect();
     // When true, nav bar is on the left side of the screen.
     private boolean mIsSeascape;
+    private static final boolean VERTICAL_LAYOUT_SHOW_APP_LABEL = true;
 
     // Notification dots
     public DotRenderer mDotRenderer;
@@ -264,7 +265,9 @@ public class DeviceProfile {
         float workspaceCellPaddingY = profile.getCellSize().y - profile.iconSizePx
                 - iconDrawablePaddingPx - profile.iconTextSizePx;
         if (workspaceCellPaddingY < profile.iconDrawablePaddingPx * 2) {
-            profile.adjustToHideWorkspaceLabels();
+            if (!VERTICAL_LAYOUT_SHOW_APP_LABEL) {
+                profile.adjustToHideWorkspaceLabels();
+            }
         }
 
         // We use these scales to measure and layout the widgets using their full invariant profile
@@ -362,7 +365,7 @@ public class DeviceProfile {
         allAppsIconDrawablePaddingPx = iconDrawablePaddingPx;
         allAppsCellHeightPx = isLabelHasCut ? cellHeightPx : getCellSize().y;
 
-        if (isVerticalLayout) {
+        if (isVerticalLayout && !VERTICAL_LAYOUT_SHOW_APP_LABEL) {
             // Always hide the Workspace text with vertical bar layout.
             adjustToHideWorkspaceLabels();
         }

  • 3
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
Androidlauncher是指安卓系统中的桌面启动器,也是安卓系统中的主要程序组件之一。它负责显示和管理用户的应用程序图标、小部件和壁纸等内容。\[3\]在大部分Android开发中,不需要改变Androidlauncher。但是对于一些定制Android系统,比如放在汽车上的平板,可能需要自己做一个定制launcher来替代Android原生态的launcher。这样可以根据需求自定义图标的数量和大小,提供更好的用户体验。\[1\]在Android系统中,launcher的主Activity是com.android.launcher2.Launcher,它在Manifest文件中进行了配置。\[2\]如果出现Launcher出错的情况,安卓系统会提示“进程 com.android.launcher 意外停止”,此时需要重新启动Launcher。\[3\] #### 引用[.reference_title] - *1* *3* [Android中的Launcher介绍](https://blog.csdn.net/qq_25314345/article/details/104251318)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [Android Launcher 详解](https://blog.csdn.net/huangyabin001/article/details/37523715)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值