Lanucherr 默认显示第几屏

Launcher.java

static final int SCREEN_COUNT = 5;
static final int DEFAULT_SCREEN = 2;//第一页是从0开始计数,这里是把第三个页面作为默认首页

launcher.xml

 

  <com.android.launcher2.Workspace  

android:id="@+id/workspace"  

android:layout_width="match_parent"  

android:layout_height="match_parent"  

android:scrollbars="horizontal"  

android:fadeScrollbars="true"  

launcher:defaultScreen="2"

workspace.java

 

mDefaultScreen = a.getInt(R.styleable.Workspace_defaultScreen, 1); 

workspace.xml

<com.android.launcher2.Workspace
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"
    android:paddingTop="@dimen/workspace_content_large_only_top_margin"
    launcher:defaultScreen="2"                         修改默认HOME屏
    launcher:pageSpacing="@dimen/workspace_page_spacing">

 

workspace的布局如下:
 

 

(0,0)
(1,0)
(2,0)
(3,0)
(4,0)
(0,1)
(1,1)
(2,1)
(3,1)
(4,1)
(0,2)
(1,2)
(2,2)
(3,2)
(4,2)

posted on 2014-11-02 21:44  robertsun  阅读(230)  评论(0编辑  收藏  举报

导航