菜单溢出3dot在某些设备上不可见 [英] Menu overflow 3dot not visible on some devices
本文介绍了菜单溢出3dot在某些设备上不可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在该溢出按钮上具有菜单按钮的设备未显示
Devices which have menu button on that overflow button not showing
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" >
<item
android:id="@+id/incoming"
android:showAsAction="always"
android:title="Incoming Call Control"/>
<item
android:id="@+id/list"
android:showAsAction="always"
android:title="Active Filter List"/>
推荐答案
在具有硬件菜单按钮的设备上不可见.要启用操作溢出图标,您可以在应用程序中进行肮脏的入侵.
Its not visible on devices which have the hardware menu button. To enable the action overflow icon, there is a dirty hack that you can do in your application.
private void getOverflowMenu() {
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) {
e.printStackTrace();
}
}
在application
类onCreate()
中调用上述方法.
这篇关于菜单溢出3dot在某些设备上不可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文