初めて起動するとき、ランチャー デスクトップはデフォルトのメイン インターフェイスにとどまります (セカンダリ ページにはジャンプしません)。

パッケージ/アプリ/Launcher3/src/com/android/launcher3/Launcher.java

方法

public void bindItems(finalList<ItemInfo> アイテム、最終ブール値 forceAnimateIcons) {

int currentScreenId =mWorkspace.getScreenIdForPageIndex(mWorkspace.getNextPage());
           final int newScreenIndex =mWorkspace.getPageIndexForScreenId(newItemsScreenId);
           final Runnable startBounceAnimRunnable = anim::start;
 
           if (newItemsScreenId != currentScreenId) {
                // We post the animationslightly delayed to prevent slowdowns
                // when we are loading rightafter we return to launcher.
                mWorkspace.postDelayed(newRunnable() {
                    public void run() {
                        if (mWorkspace != null){
                           AbstractFloatingView.closeAllOpenViews(Launcher.this, false);
 
                            /*/tyd.yantao20230201 avoid first load not in homePage
                            mWorkspace.snapToPage(newScreenIndex);
                            //*/
                           mWorkspace.postDelayed(startBounceAnimRunnable,
                                   NEW_APPS_ANIMATION_DELAY);
                        }
                    }
                }, NEW_APPS_PAGE_MOVE_DELAY);

このとき、これを入力するのは if (newItemsScreenId != currentScreenId) {、通常はこれを行うべきではないため、mWorkspace.snapToPage(newScreenIndex); は後で実行され、これは遅延スレッドにあるため、最初にメイン インターフェイス 後でサブページに移動

おすすめ

転載: blog.csdn.net/youthking1314/article/details/128913908