同时制作了下载的资源,资源是按照我我这篇文章的内容针对原生的launcher3代码做了大部分修改,横竖屏都有适配,我自己使用时直接删除了hotseat相关的部分,不过下载资源中做了保留以满足有需要的朋友,下载资源地址:https://download.youkuaiyun.com/download/weixue9/12691528
前篇文章已经能够让我们能够成功打包apk了,本人在做自定义修改的时候也借鉴了一些前辈的佳作,在文章结尾处有链接感兴趣的可以自行查看,这篇文章大部分内容与链接中的内容有重复,由于launcher3的开发时公司项目所以不便详细说明,只能总结一些大家熟知的,不过这篇文章的内容也足够满足我们初始的定制化目标,更为个性化的内容需自行摸索了,这篇主要是介绍如何修改以满足我们的需求,具体如下:
1、去掉第一屏google搜索框

修改位置
vendor\mediatek\proprietary\packages\apps\Launcher3\src\com\android\launcher3\Workspace.java
注释 bindAndInitFirstWorkspaceScreen() 中 if (qsb == null) 开始到结尾
public void bindAndInitFirstWorkspaceScreen(View qsb) {
if (!FeatureFlags.QSB_ON_FIRST_SCREEN) {
return;
}
// Add the first page
CellLayout firstPage = insertNewWorkspaceScreen(Workspace.FIRST_SCREEN_ID, 0);
if (FeatureFlags.PULLDOWN_SEARCH) {
.....
}
//add don't show google quick search box[qsb]
// Always add a QSB on the first screen.
/*if (qsb == 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.
qsb = LayoutInflater.from(getContext())
.inflate(R.layout.search_container_workspace,firstPage, false);
}
CellLayout.LayoutParams lp = new CellLayout.LayoutParams(0, 0, firstPage.getCountX(), 1);
lp.canReorder = false;
if (!firstPage.addViewToCellLayout(qsb, 0, R.id.search_container_workspace, lp, true)) {
Log.e(TAG, "Failed to add to item at (0, 0) to CellLayout");
}*/
//add don't show google quick search box[qsb]
}
2、去掉上滑后显示所有 app 界面搜索应用栏

修改位置
vendor\mediatek\proprietary\packages\apps\Launcher3\src\com\android\launcher3\allapps\AllAppsContainerView.java
在 onFinishInflate() 中添加一行 mSearchContainer.setVisibility(View.GONE);
@Override
protected void onFinishInflate() {
super.onFinishInflate();
....
mSearchContainer = findViewById(R.id.search_container_all_apps);
mSearchUiManager = (SearchUiManager) mSearchContainer;
mSearchUiManager.initialize(mApps, mAppsRecyclerView);
/// add this code don't show all app quick search box
mSearchContainer.setVisibility(View.GONE);
......
}
3、隐藏hotseat中添加老版本的所有应用图标,并去除上滑箭头和屏蔽 Drag 动画

修改位置
- (1)、 添加所有 app 按钮
vendor\mediatek\proprietary\packages\apps\Launcher3\src\com\android\launcher3\Hotseat.java
在 resetLayout() 中将 FeatureFlags.NO_ALL_APPS_ICON 写成 true 则默认加载六个点按钮
void resetLayou

本文详细介绍Launcher3的深度定制过程,包括去除特定UI元素、调整布局、禁用功能及优化应用图标显示等。通过修改源代码实现个性化需求,适合追求极致体验的开发者。
最低0.47元/天 解锁文章
1337

被折叠的 条评论
为什么被折叠?



