Android 布局问题。缺少三点菜单按钮
Android layout issue. Missing three dots menu button
我正在各种设备上测试我的应用程序,我发现在一个 phone (Kruger&Matz Muve) 上,操作栏上没有三点按钮。我在那里有一些设置,所以它必须在那里。如果有人能帮我解决这个问题,我会很高兴。
溢出图标仅出现在没有菜单硬件键的手机上
How to force action bar overflow icon to show
如果你想显示三个点,而不考虑设备菜单按钮,那么你可以在你的 Application
class onCreate
方法中调用这个方法-
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
希望对您有所帮助。
我正在各种设备上测试我的应用程序,我发现在一个 phone (Kruger&Matz Muve) 上,操作栏上没有三点按钮。我在那里有一些设置,所以它必须在那里。如果有人能帮我解决这个问题,我会很高兴。
溢出图标仅出现在没有菜单硬件键的手机上
How to force action bar overflow icon to show
如果你想显示三个点,而不考虑设备菜单按钮,那么你可以在你的 Application
class onCreate
方法中调用这个方法-
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
希望对您有所帮助。