Android布局问题。缺少三个点菜单按钮

时间:2015-07-02 09:52:46

标签: android button settings

我在各种设备上测试我的应用程序,我发现在一部手机上(Kruger& Matz Muve)操作栏上没有三个点按钮。我有一些设置,所以它必须在那里。如果有人可以帮我解决这个问题,我会很高兴。

2 个答案:

答案 0 :(得分:1)

如果您想显示三个点,无论设备菜单按钮如何,您都可以在ApplicationonCreate方法中调用此方法 -

private void makeActionOverflowMenuShown() {
//devices with hardware menu button (e.g. Samsung Note) don't show action overflow menu
try {
    ViewConfiguration config = ViewConfiguration.get(this);
    Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey");
    if (menuKeyField != null) {
        menuKeyField.setAccessible(true);
        menuKeyField.setBoolean(config, false);
    }
} catch (Exception e) {
    Log.d(TAG, e.getLocalizedMessage());
}
}

了解更多信息Android action bar not showing overflow

希望这会对你有所帮助。

答案 1 :(得分:0)

溢出图标仅出现在没有菜单硬件键的手机上

How to force action bar overflow icon to show

相关问题