How to remove or change the search view icon inside the edittext?
I am using the Appcompat library.
I used the below code to modify and remove but it's not working:
SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
View search_mag_icon = (View)searchView.findViewById(android.support.v7.appcompat.R.id.search_mag_icon);
search_mag_icon.setBackgroundResource(R.drawable.ic_stub);
//search_mag_icon.setVisibility(View.GONE);
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…