当前位置: 首页 > article >正文

[Android]相关属性功能的裁剪

1.将home界面的search bar 移除

/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java

// Add first page QSB
        if (FeatureFlags.QSB_ON_FIRST_SCREEN) {
            CellLayout firstScreen = mWorkspaceScreens.get(FIRST_SCREEN_ID);
            View qsb = mHomeElementInflater.inflate(R.layout.qsb_preview, firstScreen,
                    false);
            CellLayout.LayoutParams lp =
                    new CellLayout.LayoutParams(0, 0, firstScreen.getCountX(), 1);
            lp.canReorder = false;
          //  firstScreen.addViewToCellLayout(qsb, 0, R.id.search_container_workspace, lp, true);
        }

/src/com/android/launcher3/Workspace.java

  /**
     * Initializes and binds the first page
     */
    public void bindAndInitFirstWorkspaceScreen() {
        if (!FeatureFlags.QSB_ON_FIRST_SCREEN) {
            return;
        }

        // Add the first page
        CellLayout firstPage = insertNewWorkspaceScreen(Workspace.FIRST_SCREEN_ID, getChildCount());
        // Always add a QSB on the first screen.
        /*
           if (mQsb == null) {
            // In transposed layout, we add the QSB in the Grid. As workspace does not touch the
            // edges, we do not need a full width QSB.
            mQsb = LayoutInflater.from(getContext())
                    .inflate(R.layout.search_container_workspace, firstPage, false);
        }
        */

        int cellVSpan = FeatureFlags.EXPANDED_SMARTSPACE.get()
                ? EXPANDED_SMARTSPACE_HEIGHT : DEFAULT_SMARTSPACE_HEIGHT;
        int cellHSpan = mLauncher.getDeviceProfile().inv.numSearchContainerColumns;
        CellLayout.LayoutParams lp = new CellLayout.LayoutParams(0, 0, cellHSpan, cellVSpan);
        lp.canReorder = false;
        /*
        if (!firstPage.addViewToCellLayout(mQsb, 0, R.id.search_container_workspace, lp, true)) {
            Log.e(TAG, "Failed to add to item at (0, 0) to CellLayout");
            mQsb = null;
        }
        */
    }

如果只修改了上面的话,serach bar可以消失,但是会引入一个新问题:

还需要将Qsb的属性值QSB_ON_FIRST_SCREEN做一个更新

src_build_config/com/android/launcher3/BuildConfig.java

public final class BuildConfig {
    public static final String APPLICATION_ID = "com.android.launcher3";
    public static final boolean DEBUG = false;
    /**
     * Flag to state if the QSB is on the first screen and placed on the top,
     * this can be overwritten in other launchers with a different value, if needed.
     */
    public static final boolean QSB_ON_FIRST_SCREEN = false;
}

未完待续...


http://www.kler.cn/a/396585.html

相关文章:

  • Oracle19C AWR报告分析之Instance Efficiency Percentages (Target 100%)
  • Qt文件目录操作
  • HarmonyOS Next星河版笔记--界面开发(5)
  • CSS 响应式设计之媒体查询技术
  • 关于学习炸鸡佬智能手表 应用硬件IIC1来取代原来软件模拟的IIC
  • Mysql每日一题(行程与用户,困难※)
  • Linux---常用shell脚本
  • 力扣654:最大二叉树
  • 【鸿蒙开发】第二十二章 IPC与RPC进程间通讯服务
  • 【LeetCode】【算法】53. 最大子数组和
  • 【日常记录-Git】撤销工作区中所有已跟踪文件的修改
  • Java集合(Collection+Map)
  • 回调函数的概念、意义和应用场景
  • SQL 审核在 CloudQuery 的四大场景应用
  • leetcode hot100【 LeetCode 121.买卖股票的最佳时机】java实现
  • uniapp ios app以framwork形式接入sentry
  • 使用--log-file保存pytest的运行日志
  • WP网站如何增加文章/页面的自定义模板
  • Node.Js+Knex+MySQL增删改查的简单示例(Typescript)
  • 猫狗识别之BUG汇总
  • C++编程技巧与规范-类和对象
  • conda 和 pip 的比较
  • 嵌入式面试题练习 - 2024/11/15
  • NVR小程序接入平台/设备EasyNVR多个NVR同时管理设备接入:海康NVR 3.0提示不在线如何处理?
  • C++- 基于多设计模式下的同步异步日志系统
  • 力扣 LeetCode 150. 逆波兰表达式求值(Day5:栈与队列)