Android actionBar searview changes default search button Image
When searching for images, it is found that the default search button displayed by the searchView system is only a small arrow, which looks ugly and wants to change this icon. So I found the answer on the stackoverflow website and directly wrote the code:
@ Override public void onCreateOptionsMenu (Menu menu, MenuInflater inflater) {inflater. inflate (R. menu. event_history, menu); MenuItem search = menu. findItem (R. id. search_event); search. collapseActionView (); // It is displayed in the search box by default. // search. expandActionView (); SearchView searchView = (SearchView) search. getActionView (); // display the search confirmation button searchView. setSubmitButtonEnabled (true); // find the LinearLayout int searchPlateId = searchView corresponding to the search button. getContext (). getResources (). getIdentifier ("android: id/submit_area", null, null); LinearLayout searchPlate = (LinearLayout) searchView. findViewById (searchPlateId); // get the image view of the search icon, so that you can modify the image (imageview) searchPlate. getChildAt (0 )). setImageResource (R. drawable. audio_bar_src); searchView. setOnQueryTextListener (this); super. onCreateOptionsMenu (menu, inflater );}