2

How to change the Android searchview border color and searchview hint icon?

enter image description here

Jeroen Vannevel
  • 43,651
  • 22
  • 107
  • 170
venu
  • 2,971
  • 6
  • 40
  • 59
  • possible duplicate of [Changing the background drawable of the searchview widget](http://stackoverflow.com/questions/11085308/changing-the-background-drawable-of-the-searchview-widget) – Madan Sapkota May 27 '15 at 04:01

2 Answers2

2

You have to use reflection to style the SearchView. Check out: http://novoda.com/blog/styling-actionbar-searchview

Chris Arriola
  • 1,636
  • 3
  • 17
  • 23
0
MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.options_menu, menu);

    // Get the SearchView and set the searchable configuration
    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    SearchView searchView = (SearchView) menu.findItem(R.id.menu_search).getActionView();
    // Assumes current activity is the searchable activity
   AutoCompleteTextView searchText = (AutoCompleteTextView)searchView.findViewById(R.id.abs__search_src_text);
    searchText.setHintTextColor(getResources().getColor(R.color.white));
   searchText.setTextColor(getResources().getColor(R.color.white));
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
    searchView.setIconifiedByDefault(false);
Digvesh Patel
  • 6,503
  • 1
  • 20
  • 34