Lancher3默认桌面显示
代码位置
packages/apps/Launcher3/src/com/android/launcher3/Workspace.java
packages/apps/Launcher3/src/com/android/launcher3/Workspace.java
mOriginalDefaultPage = mDefaultPage = a.getInt(R.styleable.Workspace_defaultScreen, 1);
// 通过styleable name + _attr name得到属性值,如果没有定义则默认为1
packages/apps/Launcher3/res/values/attrs.xml
<declare-styleable name="Workspace"> <!-- The first screen the workspace should display. --> <attr name="defaultScreen" format="integer" /> <!-- The number of horizontal cells in the CellLayout --> <attr name="cellCountX" format="integer" /> <!-- The number of vertical cells in the CellLayout --> <attr name="cellCountY" format="integer" /> </declare-styleable>
packages/apps/Launcher3/layout-port/launcher.xml
<com.android.launcher3.Workspace android:id="@+id/workspace" android:layout_width="match_parent" android:layout_height="match_parent" launcher:defaultScreen="@integer/config_workspaceDefaultScreen" launcher:pageSpacing="@dimen/workspace_page_spacing" launcher:pageIndicator="@id/page_indicator"> </com.android.launcher3.Workspace>修改位置(默认显示第三页) packages/apps/Launcher3/res/values/config.xml
- <integer name="config_workspaceDefaultScreen">0</integer> + <integer name="config_workspaceDefaultScreen">2</integer>