Android: 三点图标和子菜单图标在 clicking/expanding 之后没有显示

Android: Three dot icon and sub menu icon are not showing after clicking/expanding them

我想在展开后看到三点图标和子菜单图标。

第一张图片没有显示任何图标:

应该是这样的:

您看到的是正确的 Material 菜单设计,因为 Material Design specifications 表示:

A menu is a temporary sheet of paper that always overlaps the app bar, rather than behaving as an extension of the app bar.

这是 Google 推荐的示例。

但是,您仍然可以通过创建定义溢出菜单的新样式将溢出菜单放置在工具栏下方。将此 <item name="myOverflowMenu">@style/OverflowMenu</item> 添加到您的风格中。

<style name="OverflowMenu" parent="Widget.AppCompat.PopupMenu.Overflow">
<item name="overlapAnchor">false</item>
<item name="android:dropDownVerticalOffset">?attr/actionBarSize</item>
<item name="dropDownVerticalOffset">?attr/actionBarSize</item>
<item name="android:overlapAnchor">false</item>    
</style>