一般去修改packages/apps/Launcher3 / res/xml/device_profiles.xml launcher:iconTextSize这个属性来达到改变字体显示的效果,
但是修改后没有效果,只能去看packages/apps/Launcher3 / src/com/android/launcher3/BubbleTextView.java
这个方法里控制了字体的大小
public BubbleTextView(Context context, AttributeSet attrs, int defStyle) {
if (mDisplay == DISPLAY_WORKSPACE) {
setTextSize(TypedValue.COMPLEX_UNIT_PX, grid.iconTextSizePx);
setCompoundDrawablePadding(grid.iconDrawablePaddingPx);
defaultIconSize = grid.iconSizePx;
} else if (mDisplay == DISPLAY_ALL_APPS) {
setTextSize(TypedValue.COMPLEX_UNIT_PX, grid.allAppsIconTextSizePx);
setCompoundDrawablePadding(grid.allAppsIconDrawablePaddingPx);
defaultIconSize = grid.allAppsIconSizePx;
WORKSPACE和ALL_APPS的显示是通过px计算来的,所以去修改device_profiles对应的的iconTextSize是不会有效果的,只要修改成sp方式就能达到想要的效果了
if (mDisplay == DISPLAY_WORKSPACE) {
setTextSize(TypedValue.COMPLEX_UNIT_SP, grid.inv.iconTextSize);
setCompoundDrawablePadding(grid.iconDrawablePaddingPx);
defaultIconSize = grid.iconSizePx;
} else if (mDisplay == DISPLAY_ALL_APPS) {
setTextSize(TypedValue.COMPLEX_UNIT_SP, grid.inv.iconTextSize);
setCompoundDrawablePadding(grid.allAppsIconDrawablePaddingPx);
defaultIconSize = grid.allAppsIconSizePx;
单编 mmm packages/apps/Launcher3/:Launcher3QuickStep -j16
adb push Launcher3QuickStep.apk system/system_ext/priv-app/Launcher3QuickStep/
adb reboot
验证即可.
本文介绍如何正确调整Android系统Launcher3应用中字体的大小。通常修改device_profiles.xml文件中的iconTextSize属性无法直接生效,原因是该属性使用像素(px)单位而非缩放点(sp)单位。文章提供了正确的修改方法及验证步骤。
1886

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



