Skip to content Skip to sidebar Skip to footer

Menu Item's Tittle Not Showing

Menu item's title is not showing inside fragment. I have two items in menu file, The first one is with icon and tag showAsAction=always to show the icon in toolbar. The second one

Solution 1:

The issue is the text color in the popup menu. Add the app:popupTheme attribute in your MaterialToolbar.

<com.google.android.material.appbar.MaterialToolbarapp:popupTheme="@style/AppTheme.PopupOverlay"../>

with:

<stylename="AppTheme.PopupOverlay"parent="ThemeOverlay.MaterialComponents.Toolbar.Primary" ><!-- text color --><itemname="android:textColor">@color/...</item></style>

enter image description here

Solution 2:

I also faced with same issue. In my case I used custom toolbar with style.

<androidx.appcompat.widget.Toolbar
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/ToolbarStyle" />

ToolbarStyle

<stylename="ToolbarStyle"parent="AppTheme"><itemname="android:textColorPrimary">@color/white</item></style>

So I changed android:textColorPrimary in ToolbarStyle to black and now it works fine

Post a Comment for "Menu Item's Tittle Not Showing"