2

I want to customize a searchView widget in my App. Point is to remove magnifier glass icon from it (not to make it transparent, just remove). To make it easier to understand here are some screenshots:

How it looks now:

1

And how it supposed to look:

enter image description here

I can use editText instead, but it doesn't have suggestions, which is important for me.

udenfox
  • 1,594
  • 1
  • 15
  • 25
  • possible duplicate - [http://stackoverflow.com/questions/18806877/remove-icon-title-for-actionbar-with-expanded-searchview] – Dhwanik Gandhi Aug 18 '14 at 12:41
  • "I can use editText instead, but it doesn't have suggestions, which is important for me" -- why not use `AutoCompleteTextView`, then? – CommonsWare Aug 18 '14 at 12:45
  • 1
    Dhwanik Gandhi - Read question title. NOT IN ACTIONBAR Autocomplete is not acceptable because I need list with suggestions, not autocomplete. – udenfox Aug 18 '14 at 13:58

1 Answers1

-1

It appears that the SearchView is extending LinearLayout. I guess the orientation is horizontal.

You could get the instance of SearchView and then remove the first child. I have not tried this but I think it will work.

SearchView searchView = (SearchView)findViewById(R.id.search);
// You have to play around with this but I think 0 is the right value
LinearLayout linearLayout = (LinearLayout) searchView.getChildAt(0);
linearLayout.removeViewAt(1);
hoomi
  • 1,882
  • 2
  • 16
  • 17