似乎使用低于Android Kitkat版本并且硬件有菜单按钮的设备仍然无法在屏幕上显示菜单按钮,即使使用新的r21/r22 appcompat库。
我猜测这是由内部的ActionBarPolicy
类决定的:
public boolean showsOverflowMenuButton() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
return true;
} else {
return !ViewConfigurationCompat.hasPermanentMenuKey(ViewConfiguration.get(mContext));
}
}
所以强制溢出菜单按钮只存在于Android 4.4及以上版本。
是否有办法强制在Android 4.4以下的设备上显示溢出菜单,即使它们具有硬件菜单按钮?