See the picture. How can i hide the icon \"P\" which means share to Pinterest?
I found a way to work around this. I am using support library 23.0.1, I have not tested this on other support library versions.
The solution is easy, when you create ShareActionProvider, just override method onCreateActionView() and return null for it. Then you can track all history in the popup menu, but the history will not be shown in toolbar.
Here is a code sample:
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuItem item = menu.add(Menu.NONE, R.id.menu_share, Menu.NONE, R.string.share);
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
mShareActionProvider = new ShareActionProvider(this) {
@Override
public View onCreateActionView() {
return null;
}
};
item.setIcon(R.drawable.abc_ic_menu_share_mtrl_alpha);
MenuItemCompat.setActionProvider(item, mShareActionProvider);
return true;
}
Currently I have not found any problem using this work around.