Unfortunately, there is no easy way to change the SearchView icon to a custom drawable, since the theme attribute searchViewSearchIcon is not public. See this answer for details.
However, I think that your problem is caused by inheriting from the wrong theme. Please use > android:Theme.Holo.Light.DarkActionBar as the base for your theme. Then the default icons on > the action bar should have a light color.
Old Answer: 这段代码确实改不了SearchView icon,只能改普通的 menu item
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu items for use in the action bar
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu_full_player, menu);
MenuItem item = menu.findItem(R.id.catcher_action_playPause);
Drawable icon = getResources().getDrawable(R.drawable.ic_pause_circle_outline_white_36dp);
item.setIcon(icon);
return super.onCreateOptionsMenu(menu);
}
Update
搬运工
How to change SearchView default icon?
Changing the background drawable of the searchview widget
我的测试结果:
在
values-v14/styles.xml
中设置style为android:Theme.Holo.Light
,对应图片的上部分;设置style为
android:Theme.Holo.Light.DarkActionBar
,对应图片的下部分;Old Answer: 这段代码确实改不了SearchView icon,只能改普通的 menu item