Swipe the edge of the screen and put it directly into the background without exiting the app

Swipe sideways to put the app into the background

Put the code into the activity

 //侧滑放入后台
    override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
        if (keyCode == KeyEvent.KEYCODE_BACK) {
            moveTaskToBack(false)
            return true
        }
        return super.onKeyDown(keyCode, event)
    }

Guess you like

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