is there a way to hide the icon shown in this screenshot http://s2.postimg.org/8nip77c7d/aaaa.png ........(it looks like my post is mostly code, so i add this ) here is my code :
sv = new SearchView(context);
MenuItem mi = menu.findItem(R.id.action_search);
mi.setActionView(sv);
int searchIconId = sv.getContext().getResources().
getIdentifier("android:id/search_button", null, null);
ImageView searchIcon = (ImageView) sv.findViewById(searchIconId);
searchIcon.setImageResource(R.drawable.ic_action_action_search);
try {
SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
sv.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
Field searchField = null;
searchField = SearchView.class.getDeclaredField("mCloseButton");
searchField.setAccessible(true);
ImageView closeBtn = null;
closeBtn = (ImageView) searchField.get(sv);
closeBtn.setImageResource(R.drawable.ic_action_content_clear);
int searchTextViewId = sv.getContext().getResources().getIdentifier("android:id/search_src_text", null, null);
TextView searchTextView = (TextView) sv.findViewById(searchTextViewId);
searchTextView.setTextColor(Color.parseColor("#ffffff"));
} catch (NoSuchFieldException e)
{
Log.e("sv",e.getMessage(),e);
}
catch (IllegalAccessException e)
{
Log.e("sv",e.getMessage(),e);
}
i solved it by writing hint , by adding this code at the end of the previous one
searchTextView.setTextColor(Color.parseColor("#ffffff"));
searchTextView.setHintTextColor(Color.parseColor("#aaffffff"));
searchTextView.setHint(getString(R.string.recherche));
screenshot here http://s16.postimg.org/yt1wogfx1/Screenshot_2015_04_13_22_11_35.png