android Intent jumps to the bottom pop-up box

android Intent jumps to the bottom pop-up box

In the above code
1, in the click event of activity or fragment,
this code is to click and jump to the page from bottom to top.

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

2. This code is to pop up the page when returning to the page after jumping to it. It is written in the activity or fragment code that jumped to the past. It is a method in the activity or fragment.

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

3. xml code, you need to create anim package under res to create
1. bottom_in.xml code

<?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 code

<?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 code

<?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>

Insert image description here

Guess you like

Origin blog.csdn.net/jiayuanwai/article/details/131442444