launcher中Workspace類大致分析

2021-08-25 15:36:32 字數 780 閱讀 9325

1) computescroll():重寫了父類的computescroll();主要功能是計算拖動的位移量、更新背景、設定要顯示的螢幕(setcurrentscreen(mcurrentscreen);)。

3) onmeasure():重寫了父類的onmeasure();主要功能是設定螢幕的顯示大小。由每個child的measure()方法設定。

4) onlayout():重寫了父類的onlayout();主要功能是設定螢幕的顯示位置。由child的layout()方法設定。

5) onintercepttouchevent():重寫了父類的onintercepttouchevent();主要功能是在ontouchevent()方法之前處理touch事件。包括:down、up、move事件。

 用xy記錄滑鼠移動時的座標值;

 mlastmotionx和mlastmotiony記錄了上次滑鼠按下時的xy值,在action_move中賦值;

 xdiff和ydiff記錄xy與mlastmotionx、mlastmotiony差值的絕對值;

 touchslop為系統定義的標準值,初值為16;

 當xdiff和ydiff大於touchslop時就認為介面拖動了足夠大的距離,螢幕就可以移動了;

 當onintercepttouchevent()返回true時進入ontouchevent()。

6) ontouchevent():重寫了父類的ontouchevent();主要功能是處理onintercepttouchevent()返回值為true時傳遞過來的touch事件。

在Launcher3中增加主題切換功能

說明,在sd卡中放入theme thumbs資料夾,裡面存放主題風格的縮圖,然後在theme檔案下存放主題的資源檔案,例如 theme sport等等,裡面圖示命名規則是主題key 加上快捷方式的類名 下劃線取代點 例如sport com android browser browseractivit...

在Launcher3中增加主題切換功能

說明,在sd卡中放入theme thumbs資料夾,裡面存放主題風格的縮圖,然後在theme檔案下存放主題的資源檔案,例如 theme sport等等,裡面圖示命名規則是主題key 加上快捷方式的類名 下劃線取代點 例如sport com android browser browseractivit...

launcher的屏數修改

對橫屏修改 launcher res layout land launcher.xml 對豎屏修改 launcher res layout port launcher.xml 修改下列 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 com.android.lau...