簡體   English   中英

使用fragment.setEnterTransition可以正常工作,但是即使我沒有設置任何exitTransition,退出時也會發生相同的動畫

[英]Using fragment.setEnterTransition works but the same animation occurs on Exit as well, although i have not set any exitTransition

以下代碼也可用於輸入動畫和退出動畫,我不希望它在退出時進行動畫處理。 我在這里做錯了什么。

        MyProfileFragment profileFragment = new MyProfileFragment();
        FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
        ft.replace(R.id.content_frame, profileFragment);

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            profileFragment.setEnterTransition(new Fade().setDuration(200));
            //profileFragment.setExitTransition(new Fade().setDuration(0));
        }

        ft.addToBackStack("profile");
        ft.commit();

默認情況下,該Fragment退出時,傳遞給Fragment.setEnterTransition的值將反轉。 為避免這種情況,可以為Fragment.setExitTransition分配null或另一個值。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM