android - How to delete or change the searchview icon inside the SearchView actionBar? -


screenshot

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

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

order - Notification for user in user account opencart -