0
我從底部到頂部添加帶有動畫的片段,然後當按下背面或調用popBackStack()時,它應該從頂部向下。爲什麼片段退出動畫不起作用?
val confirmFragment = ConfirmFragment.Companion.newInstance(item)
val transaction = MainActivity.getMainActivity(context)!!.supportFragmentManager.beginTransaction()
transaction.addToBackStack(tag)
transaction.setCustomAnimations(R.anim.slide_in_bottom, R.anim.slide_out_top)
transaction.replace(R.id.over_view, confirmFragment, tag)
transaction.commit()
ExitAnimation(XML)
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" >
<translate
android:duration="700"
android:fromYDelta="100%"
android:toYDelta="0%" >
</translate>
</set>
EnterAnimation(XML)
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" >
<translate
android:duration="1700"
android:fromYDelta="0%"
android:toYDelta="100%" >
</translate>
</set>
的進入動畫作品,但是當片段存在,它不工作
你想:'setCustomAnimations(INT輸入,詮釋出,詮釋popEnter,INT popExit)'代替。 –
@Mark Keen謝謝 請將您的評論寫爲答案,我可以接受。 –