zl程序教程

您现在的位置是:首页 >  移动开发

当前栏目

猿创征文|Android 11.0 12.0Launcher3中app列表页的app名称分两行显示

AndroidApp列表 显示 名称 11.0 12.0 征文
2023-09-14 09:05:05 时间

1.概述

  在Launcher3桌面显示列表中,由于在app列表页中,由于有些app名称长度有些长,而系统默认显示一行,显示不下就省略号显示,由于页面高度有多余的,所以要求显示全app名称,这就需要看哪里配置app显示行数了

2.Launcher3中app列表页的app名称分两行显示的核心代码

  packages/apps/Launcher3/src/com/android/launcher3/allapps/AllAppsGridAdapter.java
  packages/apps/Launcher3/res/layout/all_apps_icon.xml

3.Launcher3中app列表页的app名称分两行显示的功能分析以及实现

  3.1AllAppsGridAdapter.java相关绑定app列表的相关代码分析

public class AllAppsGridAdapter extends RecyclerView.Adapter<AllAppsGridAdapter.ViewHolder> {
 
     public static final String TAG = "AppsGridAdapter";
 
     // A normal icon
     public static final int VIEW_TYPE_ICON = 1 << 1;
     // The message shown when there are no filtered results
     public static final int VIEW_TYPE_EMPTY_SEARCH = 1 << 2;
     // The message to continue to a market search when there are no filtered results
     public stati