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
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">
Search In Blog
Want to donate?
Recent Posts: My Android Solutions
If you ever wondered how to read and parse a simple JSON file stored in the assets directory of your Android project, here is a way to do it.
In this tutorial I will create a simple Sectioned RecyclerView that will show 2 sections and a few items in each section and how to move an item from one section to another. Note: For RecyclerView I used AndroidX imports and not android.support.v7.widget.RecyclerView! Setup We need to import the recycler view from AndroidX. The build.gradle…
Recently, I had to add a perfect square CardView and I wanted to achieve this without hardcoding its width and height. I happily discovered the power of ConstraintLayout and this is how I managed to create a perfect square which should work on every dimension. In my project I created a RecyclerView with 2 columns,…