I defined a menu item that has ShareActionProvider and share white icon like so :
-
This is a theming issue. Depending on your current theme, you need to set the correct ActionBar overlay theme. The Action Provider reads a value in the theme (which indicates if the theme is dark or light) to determine the color of the icon.
If your main theme is light and your ActionBar is dark, your ActionBar/Toolbar must use the theme ThemeOverlay.AppCompat.Dark.ActionBar
.
short Answer --> use app:iconTint="?android:textColorPrimary"
if you want the icon color to be white, write:
android:theme = "@style/ThemeOverlay.MaterialComponents.Dark.ActionBar"
else if you want black color, write:
android:theme="@style/ThemeOverlay.MaterialComponents.Light"
to your toolbar
app:iconTint="@color/colorWhite"
add this in Navigational view properties
Ex -
<com.google.android.material.navigation.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@color/main_color"
app:itemBackground="@drawable/divider_menu_items"
app:itemTextColor="@color/colorWhite"
app:itemIconTint="@color/colorWhite"
app:menu="@menu/activity_main_drawer"/>
Adding this all menu item icons convert to color given by you.