android - How to delete or change the searchview icon inside the SearchView actionBar? -
how remove or change search view icon inside edittext? using appcompat library.
i used below code modify , remove 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);
finally found solution. try following:
try { field mdrawable = searchview.class.getdeclaredfield("msearchhinticon"); mdrawable.setaccessible(true); drawable drawable = (drawable)mdrawable.get(your search view here); drawable.setalpha(0); } catch (exception e) { e.printstacktrace(); }
Comments
Post a Comment