一般去修改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
验证即可.