【问题标题】:Appcompat three dot menu not displayed on Android < 3Appcompat 三点菜单在 Android < 3 上不显示
【发布时间】:2015-02-03 17:30:58
【问题描述】:

我想在我的应用程序中显示三点菜单,也可以在 android 版本低于 3.0 的设备上显示。

但在 Android 版本

我试图为此找到任何 wotking 解决方案,但他们没有为我工作。 在所有设备上解决此问题的最简单方法是什么?

我正在使用 appCompat_v7_3

非常感谢您的任何建议。

这里是菜单和活动的代码。

菜单 main_activity.xml

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">
    <item android:id="@+id/last_position_menu_btn"
        android:icon="@drawable/ic_drawer"
        android:title="@string/last_positions"
        android:showAsAction="always"/>
    <item android:id="@+id/settings_menu_btn"
        android:icon="@drawable/ic_drawer"
        android:title="@string/app_settings"
        android:showAsAction="always"/>
</menu>

来自主 Activity 的 onCreateOptionMenu

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.main_activity, menu);

        return super.onCreateOptionsMenu(menu);
    }

【问题讨论】:

标签: android menu android-actionbar compatibility android-appcompat


【解决方案1】:

您的 3.0 设备有一个硬件菜单按钮。存在硬件菜单按钮时,Android 不会显示溢出图标。

请参阅this questionthe documentation

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多