Java,J2EE,Weblogic,Oracle

          java項目隨筆
          隨筆 - 90, 文章 - 6, 評論 - 61, 引用 - 0
          數(shù)據(jù)加載中……

          launcher修改--修改launcher的屏幕數(shù)

          首先,在Launcher.java代碼中,第125行

          1. static final int SCREEN_COUNT = 5;  
          2. static final int DEFAULT_SCREEN = 2;//第一頁是從0開始計數(shù),這里是把第三個頁面作為默認首頁  

          第一個參數(shù)定義屏幕個數(shù),第一個參數(shù)是默認的首頁。在這里,你可以做出自己的修改。但是,僅這點修改,遠遠不夠,我們看一下launcher.xml

          1. <com.android.launcher2.DragLayer  
          2.     xmlns:android="http://schemas.android.com/apk/res/android"  
          3.     xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"  
          4.   
          5.     android:id="@+id/drag_layer"  
          6.     android:layout_width="match_parent"  
          7.     android:layout_height="match_parent">  
          8.   
          9.     <include layout="@layout/all_apps" />  
          10.   
          11.     <!-- The workspace contains 3 screens of cells -->  
          12.     <com.android.launcher2.Workspace  
          13.         android:id="@+id/workspace"  
          14.         android:layout_width="match_parent"  
          15.         android:layout_height="match_parent"  
          16.         android:scrollbars="horizontal"  
          17.         android:fadeScrollbars="true"  
          18.         launcher:defaultScreen="2">  
          19.   
          20.         <include android:id="@+id/cell1" layout="@layout/workspace_screen" />  
          21.         <include android:id="@+id/cell2" layout="@layout/workspace_screen" />  
          22.         <include android:id="@+id/cell3" layout="@layout/workspace_screen" />  
          23.         <include android:id="@+id/cell4" layout="@layout/workspace_screen" />  
          24.         <include android:id="@+id/cell5" layout="@layout/workspace_screen" />  
          25.   
          26.     </com.android.launcher2.Workspace>  

          我們可以看到 導(dǎo)入了五個workspace_screen,在這里,參照你上面修改的參數(shù),添加或者刪除workspace_screen。在這里,你可能也注意到了

          1. launcher:defaultScreen="2">  

          在這里定義的defaultScreen。

          同時,要修改workspace.java中180

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

          和res/xml文件中default_workspace做出相應(yīng)的修改。這樣就基本上可以了。

          posted on 2013-02-25 15:07 龔椿深 閱讀(1806) 評論(0)  編輯  收藏


          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 察哈| 龙江县| 雷山县| 大名县| 阜宁县| 安达市| 六盘水市| 增城市| 沂源县| 怀仁县| 浪卡子县| 建宁县| 滨州市| 涞水县| 鄂州市| 阿瓦提县| 长宁区| 泸溪县| 红安县| 邵东县| 罗江县| 鹿邑县| 宜春市| 抚州市| 耒阳市| 商河县| 界首市| 密云县| 聂拉木县| 镇康县| 通城县| 汾阳市| 宝鸡市| 分宜县| 海宁市| 银川市| 万年县| 怀集县| 墨脱县| 甘泉县| 禄劝|