问题
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"/>
回答1:
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();
}
}
Call the above method in your application
class onCreate()
.
来源:https://stackoverflow.com/questions/27354064/menu-overflow-3dot-not-visible-on-some-devices