0

I'm using a ShareActionProvider, defined in code, not xml, on a dark action bar (Theme.Holo/DeviceDefault.Light.DarkActionBar).

This is what I'm seeing:

enter image description here

Note that there is almost no visible hint that the share icon and messenger icon belong together. The surrounding box is dark instead of light gray.

pjv
  • 10,658
  • 6
  • 43
  • 60

1 Answers1

3

When defining the ShareActionProvider in code, especially when the action bar is differently themed (in this case because it's dark), you need to use a themed context, obtained from the action bar, not just a regular context:

final Context themedContext = context.getActionBar().getThemedContext();
ShareActionProvider ap = new ShareActionProvider(themedContext);
menuItem.setActionProvider(ap);

Thanks to Adam Powell for pointing that out.

pjv
  • 10,658
  • 6
  • 43
  • 60