【发布时间】:2018-10-04 06:18:22
【问题描述】:
你知道如何使用 kotlin 将自定义过渡动画注入到下面的 replaceFragment() 方法吗?它是一个片段到片段的过渡
private inline fun FragmentManager.inTransaction(func: FragmentTransaction.() -> FragmentTransaction) {
beginTransaction().func().commit()
}
private fun addFragment(fragment: Fragment, frameId: Int) {
supportFragmentManager.inTransaction { add(frameId, fragment) }
}
public fun replaceFragment(fragment: Fragment, frameId: Int) {
supportFragmentManager
.inTransaction { replace(frameId, fragment)
}
【问题讨论】:
标签: android android-fragments kotlin kotlin-android-extensions kotlin-extension