MaterialSearchBar
MaterialSearchBar copied to clipboard
How to make search bar always focusable to mode?
Is it possible to make search bar always focusable mode, because yet i need to click two times to then i am able to search any thing so please share with me any method by that i can achieve this function.
add searchBar.enableSearch(); This will pre-enable the search .
add searchBar.performClick() as well. It will change to search mode.
I already try this method with search bar but in this condition, if I wanna go back to the previous page so I need to press back button two times.
That's a bug . I am facing that problem too.
I see the code ,author override the dispatchKeyEvent ,so you can go back the previous page by this :
override fun dispatchKeyEvent(event: KeyEvent): Boolean {
if (event.keyCode == KeyEvent.KEYCODE_BACK && searchBar.isSearchEnabled) {
finish()
return true
}
return super.dispatchKeyEvent(event)
}