Nested fragments disappear during transition animation

后端 未结 16 1745
广开言路
广开言路 2020-11-29 15:50

Here\'s the scenario: Activity contains fragment A, which in turn uses getChildFragmentManager() to add fragments A1 and A2

16条回答
  •  悲哀的现实
    2020-11-29 16:08

    you can do this in the child fragment.

    @Override
    public Animator onCreateAnimator(int transit, boolean enter, int nextAnim) {
        if (true) {//condition
            ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(getView(), "alpha", 1, 1);
            objectAnimator.setDuration(333);//time same with parent fragment's animation
            return objectAnimator;
        }
        return super.onCreateAnimator(transit, enter, nextAnim);
    }
    

提交回复
热议问题