Android : How to set custom icon on ShareCompat menu?

on Wednesday, October 29, 2014


I have made sharecompat menu like this:


ShareCompat.IntentBuilder b = ShareCompat.IntentBuilder.from(this);



b.setText(getString(R.string.share))
.setText(buildShareText())
.setType("text/plain")
.getIntent();


MenuItem item = menu.add(getString(R.string.share));
ShareCompat.configureMenuItem(item, b);
MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);


but it comes only with standard share icon. It is beautiful, but my design has little differences. In that case item.setIcon() doesn't work.


Is it possible to use custom icon on ShareCompat menu programmatically?


0 comments:

Post a Comment