I am trying to test something with menu options in Android.. And I noticed that menu icons are not displaying if the targetSdkVersion
is greater than 10...
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@+id/about" android:title="@string/about_label"
android:icon="@android:drawable/ic_menu_info_details" android:alphabeticShortcut="a" />
<item android:id="@+id/help" android:title="@string/help_label"
android:icon="@android:drawable/ic_menu_help" android:alphabeticShortcut="h" />
</menu>
I am trying to debug, and I am not sure where to start.
Click res → New → Vector Asset . Choose the icon that you want by clicking on the android icon, click “Next” button and then click “Finish”. 6- Now we can add android menu items with icons, we will have 4 menu items. 1 menu item will be the root while the other 3 menu items will be grouped under a single Menu .
android.view.MenuItem. Interface for direct access to a previously created menu item. An Item is returned by calling one of the Menu. add(int) methods. For a feature set of specific menu types, see Menu .
Starting with API Level 11 (Android Honeycomb) Android introduced a new concept for menus. Devices build for that API Level do not have a menu key anymore. Instead of showing a menu after a key is pressed there is a new UI Component: the Actionbar. The Actionbar now shows as much menu items as the space allows and after that creates a button that will show the rest of the menu items in an overlay.
I would assume that you are using some kind of theme for your activity that prevents the Actionbar from appearing and therefore no menu items are visible. Also read the guide on how to support Tablets and Handsets to begin to understand how the new actionbar works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With