I'm developing an application where the user presses the "Search" icon in the ActionBar
and a SearchView
is made visible at the top of the screen.
My problem is that the SearchView
is not in focus nor expanded so the user has to press the search button on the Searchview
to make it expand and bring out the keyboard.
How should this be solved?
To make the SearchView expanded by default, call setIconifiedByDefault(false) on it when you initialise it (e.g. in onCreateOptionsMenu(..)
or onPrepareOptionsMenu(..)
). I've found in most cases this will give it focus automatically, but if not simply call requestFocus()
on it too.