Launcher界面下Google文件夹修改背景,应用间的间宽尺寸资源等信息以及google文件夹中各个应用的大小调整~
二 主要的布局文件
1. res/layout/user_folder.xml:布局文件,用来修改背景等信息的
2. res/values/colors.xml:颜色等资源设置
+ <color name="quantum_panel_transparent_bg_text_color">#EED8AE</color>
3. res/values/styles.xml
<style name="Icon.AllApps">
<item name="android:background">@null</item>
- <item name="android:textColor">@color/quantum_panel_text_color</item>
+ <item name="android:textColor">@color/quantum_panel_transparent_bg_text_color</item>
<style name="Icon.Folder">
<item name="android:background">@null</item>
- <item name="android:textColor">@color/quantum_panel_text_color</item>
+ <item name="android:textColor">@color/quantum_panel_transparent_bg_text_color</item>
<item name="android:shadowRadius">0</item>
<item name="customShadows">false</item>
.left, 0,
- padding.right, 0);
+ getResources().getDrawable(R.drawable.apps_menu_background), 0, 0,
+ 0, 0);
Rect bgPadding = new Rect()
三 涉及的类文件:
1. packages/apps/Launcher3/src/android/DeviceProfile.java
// Folder
folderCellWidthPx = cellWidthPx + 3 * edgeMarginPx;
if(SystemProperties.is_lax_tel_mx()) {
folderCellHeightPx = cellHeightPx + edgeMarginPx+40;
} else {
folderCellHeightPx = cellHeightPx + edgeMarginPx;
}
folderBackgroundOffset = -edgeMarginPx;
folderIconSizePx = iconSizePx + 2 * -folderBackgroundOffset;
2. src/com/android/launcher3/DeviceProfile.java
主要修改了updateIconSize()函数中的方法;
3. src/com/android/launcher3/allapps/AllAppsContainerView.java
public class AllAppsContainerView extends BaseContainerView implements DragSourc
// TODO: Use quantum_panel instead of quantum_panel_shape
InsetDrawable background = new InsetDrawable(
- getResources().getDrawable(R.drawable.quantum_panel_shape), paddin g
四 针对布局文件Launcher.xml的分析
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"
android:id="@+id/launcher"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/workspace_bg">
<com.android.launcher2.DragLayer
android:id="@+id/drag_layer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<!-- 桌面的分隔线,将hotseat和workspace分割开来 -->
<include
android:id="@+id/dock_divider"
layout="@layout/workspace_divider"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/button_bar_height"
android:layout_gravity="bottom" />
<!-- 桌面分隔线上的指示条,workspace翻页的时候会显示 -->
<include
android:id="@+id/paged_view_indicator"
layout="@layout/scroll_indicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginBottom="@dimen/button_bar_height" />
<!--手机桌面,默认系统是包含可翻转5页 -->
<com.android.launcher2.Workspace
android:id="@+id/workspace"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingStart="@dimen/workspace_left_padding"
android:paddingEnd="@dimen/workspace_right_padding"
android:paddingTop="@dimen/workspace_top_padding"
android:paddingBottom="@dimen/workspace_bottom_padding"
launcher:defaultScreen="2"
launcher:cellCountX="@integer/cell_count_x"
launcher:cellCountY="@integer/cell_count_y"
launcher:pageSpacing="@dimen/workspace_page_spacing"
launcher:scrollIndicatorPaddingLeft="@dimen/workspace_divider_padding_left"
launcher:scrollIndicatorPaddingRight="@dimen/workspace_divider_padding_right">
<!--workspace总共可翻转5个页面,一个workspace_screen定义一个页面布局 -->
<include android:id="@+id/cell1" layout="@layout/workspace_screen" />
<include android:id="@+id/cell2" layout="@layout/workspace_screen" />
<include android:id="@+id/cell3" layout="@layout/workspace_screen" />
<include android:id="@+id/cell4" layout="@layout/workspace_screen" />
<include android:id="@+id/cell5" layout="@layout/workspace_screen" />
</com.android.launcher2.Workspace>
<!--hotseat为桌面分隔线下的界面,不随workspace翻页操作而移动的部分 -->
<include layout="@layout/hotseat"
android:id="@+id/hotseat"
android:layout_width="match_parent"
android:layout_height="@dimen/button_bar_height_plus_padding"
android:layout_gravity="bottom" />
<!--qsb_bar布局包含桌面上的可搜索框,以及长按桌面上图标时显示删除和应用信息的操作框 -->
<include
android:id="@+id/qsb_bar"
layout="@layout/qsb_bar" />
<!-- workspace_cling手机刚开机或者对launcher应用清空数据第一次进入到workspace时弹出的操作介绍界面 -->
<include layout="@layout/workspace_cling"
android:id="@+id/workspace_cling"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" />
<!--folder_cling手机刚开始或者对launcher应用清空数据,第一次打开将workspace上两个以上的图标拖到一起形成文件夹时弹出的操作界面 -->
<include layout="@layout/folder_cling"
android:id="@+id/folder_cling"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" />
<!-- voice_button_proxy音量按键。。。。 -->
<com.android.launcher2.DrawableStateProxyView
android:id="@+id/voice_button_proxy"
android:layout_width="80dp"
android:layout_height="@dimen/qsb_bar_height"
android:layout_gravity="top|end"
android:clickable="true"
android:onClick="onClickVoiceButton"
android:importantForAccessibility="no"
launcher:sourceViewId="@+id/voice_button" />
<!-- apps_customize_pane点击hotseat中心图标进入的界面,该界面显示所用应用和小部件(widget) -->
<include layout="@layout/apps_customize_pane"
android:id="@+id/apps_customize_pane"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="invisible" />
</com.android.launcher2.DragLayer>
</FrameLayout>