Android ShareActionProvider Change Text Color
- Home
- chevron_right
- Solutions
- chevron_right
- Android ShareActionProvider Change Text Color
I think I spent 2 days in order to find a way of changing the text color of the ShareActionProvider. There are some posts on the internet but none worked for me. So I started to try myself each and every item attribute from @style/Theme.AppCompat.Light.DarkActionBar. After a while I found the items I was looking for:
<item name="textAppearanceLargePopupMenu"> <item name="textAppearanceSmallPopupMenu">
NOTE: Notice that I used
textAppearanceLargePopupMenu
and NOT
android:textAppearanceLargePopupMenu
This was one of the mistakes I was doing when I tried different items. It seems that if I use “android:” it will not work.
So you need to create a style for these 2 in which you have to set the text color.
ShareActionProvider Custom Style (MyShareActionProviderStyle)
<style name="MyShareActionProviderStyle" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Subtitle"> <item name="android:textColor">@android:color/holo_red_dark</item> </style>
Now you should apply the style to those 2 items in your application custom theme.
Application Custom Theme (MyCustomAppTheme)
<style name="MyCustomAppTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar"> <item name="textAppearanceLargePopupMenu">@style/MyShareActionProviderStyle</item> <item name="textAppearanceSmallPopupMenu">@style/MyShareActionProviderStyle</item> </style>
MyCustomAppTheme will be set in the AndroidManifest.xml as the application theme.
<application android:name=".utils.ApplicationProvider" android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/MyCustomAppTheme">