0

In the android default search view, 2 clicks are required to input text for search as the first click is used to expand the editText view and another click is to set focus.

It seems to be q redundant and i want to reduce the process to one click only. Is there any methods to do this?

Antoine Murion
  • 773
  • 1
  • 14
  • 26

2 Answers2

1

You can change this behavior by calling

setIconifiedByDefault(false)

on your searchView. Setting it to false will show the whole field.

Documentation here.

scottD
  • 135
  • 8
0

The two clicks happen if we put the searchView inside a ListView as the searchView lost focus after that. I suspect searchView behave a similar property with editText view in listView.

With reference to Edit Text in ListActivity ListView loses focus when keyboard comes up

and add the following codes in searchView xml android:focusable="true" android:focusableInTouchMode="true"

would get back the normal behavior of the searchView. Hope this will be useful to other people in the future.

Community
  • 1
  • 1
Antoine Murion
  • 773
  • 1
  • 14
  • 26