0

Is there a style that works with the Android ShareActionProvider that allows the text to be white instead of black. I have tried:

<item name="android:textColor">@android:color/white</item>
<item name="android:itemTextAppearance">@style/menu_color</item>
<item name="android:textAppearanceListItem">@style/menu_color</item>
<item name="android:textAppearanceListItemSmall">@style/menu_color</item>
<item name="android:textAppearanceLarge">@style/menu_color</item>`
<item name="android:textAppearanceLargePopupMenu">@style/MyShareActionProviderStyle</item>`
<item name="android:textAppearanceSmallPopupMenu">@style/MyShareActionProviderStyle</item>`
<item name="android:actionMenuTextAppearance">@style/share_item_color</item>

I have tried all of these properties in a number of different configurations and cannot seem to find the right property to change to get the text to be the correct color.

I am using a Holo theme base and I am not using AppCompat or ActionBarSherlock. Thanks for your help in advance.

Stephen
  • 174
  • 4
  • 14

2 Answers2

0

Here is what I ended up doing:

First I created a subclass of ShareActionProvider and set that in the menu xml file for that fragment as the android:actionProviderClass

Then in the onCreateActionView of that ShareActionProvider subclass i did this:

View v = super.onCreateActionView();
for(int i=0; i<((ViewGroup)v).getChildCount(); ++i) {
    View nextChild = ((ViewGroup)v).getChildAt(i);
    TextView title = (TextView)nextChild.findViewById(android.R.id.title);
    if(title != null){
        title.setTextColor(Color.WHITE);
    }
}
return v;

That got me the text of the menu white like I needed. Hope this helps someone in the future.

Stephen
  • 174
  • 4
  • 14
0

If you are using toolbar you don't need to extend ShareActionProvider. Only you need to apply theme in toolabr app:theme="@style/toolbarTheme"

And here is the theme code

<style name="toolbarTheme" parent="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
        <item name="android:textColor">@android:color/white</item>
        <item name="android:textColorPrimary">@android:color/white</item>
</style>
Max
  • 5,733
  • 4
  • 30
  • 44