Alternative method to view.Menu *

2

I'm a beginner with Android programming and I'm following the book " Google Android " (2012) of the Code House .

I came to a part where you should create "menus" using the functions found in android.view.menu * , and the expected result should look something like the one below:

However,whenrunningonmydevice(Android5.1.1)themenudoesnotappearandnoerroristriggered.

IdidsomeresearchandIcametotheconclusionthatthisisbecausethenewerversionsofandroidnolongerhavethe"options" button (or something like that).

Well, I would like to know if there are alternative ways of representing these menus, since in the course of the course, new implementations will be made using these menus.

Thank you for your attention!

Michael.

    
asked by anonymous 30.03.2017 / 01:21

1 answer

1

This feature has really changed and today Android does not behave this way. This can be checked here:

link

  

The options menu is where you should include actions and other options that   are relevant to the current activity context, such as "Search",   "Write Email" and "Settings."

     

The location where items in the options menu appear on the screen depends on the   version where the application was developed:

     

If you have developed the application for Android 2.3.x (API level   10) or lower, the contents of the option menu will appear in the   screen when the user presses the Menu button, such as   shown in figure 1. When opened, the first visible part is the menu   icon that has up to six menu items. If the menu includes more than   six items, Android will place the sixth item and the rest in a menu   floating point that the user can open by selecting More. If you   developed the application for Android 3.0 (Level 11 API) or   options menu items are available in the   applications. By default, the system places all items in the actions   additional information that the user can reveal with the additional actions icon   on the right side of the application bar (or by pressing the Menu button   on the device, if available). To enable fast access to actions   important, you can promote some items to appear in the toolbar.   of applications adding android: showAsAction="ifRoom" to elements    (see figure 2). For More Information   about the action items and other behaviors of the bar   applications, see the Adding the application bar lesson.

Another point to consider is that only 1.7% of smartphones today use Android version 2.3 (Gingerbread), so it would be more advisable for you to update your study material, I suggest even the Android developer site or other options

OtherlinkstomorecurrentAndroidmaterials:

30.03.2017 / 01:39