flutter页面以抽屉的方式打开关闭动效

打开:

val intent = Intent(context, FlutterAppActivity::class.java)
intent.action = Intent.ACTION_RUN
intent.putExtra(EXTRA_PARAMS, map as Serializable)
intent.putExtra("route", router)
context.startActivity(intent, ActivityOptions.makeCustomAnimation(context as Activity?, R.anim.right_enter, 0).toBundle())

关闭:
override fun finish() {
    super.finish()
    overridePendingTransition(0, R.anim.right_eixt)
}
R.anim.right_eixt
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:interpolator="@android:anim/decelerate_interpolator" >

    <translate
        android:duration="250"
        android:fromXDelta="100%"
        android:toXDelta="0" />

</set>

R.anim.right_eixt
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:interpolator="@android:anim/decelerate_interpolator" >

    <translate
        android:duration="250"
        android:fromXDelta="0"
        android:toXDelta="100%" />

</set>

 

posted on 2024-10-17 15:29  白衣雨果  阅读(9)  评论(0编辑  收藏  举报