android Intent跳转底部弹框弹出

android Intent跳转底部弹框弹出

上代码
1、activity或者fragment的点击事件里面
这个代码是点击跳转过去从下往上出现页面弹入

ll_accounting_ft.setOnClickListener {
            var intent = Intent(this, AccountingActivity().javaClass)
            startActivity(intent)
            overridePendingTransition(R.anim.bottom_in, R.anim.bottom_silent)
        }

2、这个代码是跳转过去之后返回页面销毁的时候弹出页面,在跳转过去的activity或者fragment代码里面写入,是activity或者fragment里面的方法

override fun finish() {
        super.finish()
        overridePendingTransition(R.anim.bottom_silent, R.anim.bottom_out)
    }

3、xml代码,需要在res下面创建anim包创建
1、bottom_in.xml 代码

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
    <translate
        android:duration="800"
        android:fromYDelta="100%p"
        android:toYDelta="0" />
</set>

2、bottom_out.xml 代码

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
    <translate
        android:duration="800"
        android:fromYDelta="25"
        android:toYDelta="100%p" />
</set>

3、bottom_silent.xml 代码

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
    <translate
        android:duration="0"
        android:fromYDelta="0"
        android:toYDelta="0" />
</set>

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/jiayuanwai/article/details/131442444