how do i use the back arrow in searchview in the toolbar?

Hi you should set expend listener to the search view

searchMenu.setOnActionExpandListener(
    object : MenuItem.OnActionExpandListener {
        override fun onMenuItemActionCollapse(item: MenuItem): Boolean {
            // Called when SearchView is collapsing
            // Custom code to run on back pressed
            return true
        }

        override fun onMenuItemActionExpand(item: MenuItem): Boolean {
            // Called when SearchView is expanding
            // Custom code to run on search view activated
            return true
        }
    })

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top