fragments, android:zAdjustment (z order) and animations

前端 未结 3 1550
小蘑菇
小蘑菇 2021-02-04 00:17

I\'m using the support library. Now, I want to have a fragment shifting in from the bottom, moving OVER the previous one.

For this I use this to keep the previous fragme

3条回答
  •  不思量自难忘°
    2021-02-04 00:21

    I've also got stuck with that problem. So instead of using transaction.replace(containerId, newFragment) I've created two containers for fragments and now my code looks like this one

    Add first fragment:

    transaction.add(containerId1, firstFragment).commit();
    

    Add second fragment with animation over the first one:

    findViewById(containerId2).bringToFront();
    transaction.setCustomAnimations(R.anim.slide_in_up,
     R.anim.stay).remove(oldFragment).add(containerId2, newFragment).commit()
    

提交回复
热议问题