I have SearchView in my toolbar and I am wondering how can I change search icon inside SearchView Edittext drawableleft icon color programatically?
searchView = menu.findItem(R.id.action_search)?.actionView as? SearchView
I know using findViewById of SearchView I can find components of SearchView and do it But it doesn't work and I would like to know if it possible to change edittext underline color programatically?
Here is my image you can see what I mean and I have changed the close button color I want to have the same for other components
val searchText = searchView?.findViewById(R.id.search_src_text) as SearchView.SearchAutoComplete
searchText.compoundDrawables[0].setTint(Color.RED)
It should work
val searchIcon = searchView.findViewById(R.id.search_mag_icon) as ImageView
searchIcon.setColorFilter(Color.Red)