问题
I have an app that's been running for years, and constantly get's updated. Originally it had a menu with some shortcuts, but it's not necessary to operate the app, so no big deal as the menu button started to disappear from new devices.
Now I have a customer complaining that a floating menu button appears on he's HTC one, and it actually covers some other buttons in my app. (That's not the case on my Samsung S5 nor Lenovo Yoga tablet)
I've removed "onCreateOptionsMenu" and "onOptionsItemSelected" from my activity, and I can no longer access the menu on my devices, but the HTC user says the floating menu button is still on he's HTC, it just doesn't do anything.
How do I remove that button?
回答1:
In your onCreateOptionsMenu() do this
MenuItem settingsItem = menu.findItem(R.id.action_settings);
settingsItem.setVisible(false);
回答2:
You have to set your targetSdk higher then 13 in your gradle build files.
Thanks to the answer of Ankush Sharma https://stackoverflow.com/a/33086729/2607567.
来源:https://stackoverflow.com/questions/29495066/remove-floating-menu-button-from-htc-one