Home » Android » user experience – Best practices for implementing a multi-level Option Menu on Android?

user experience – Best practices for implementing a multi-level Option Menu on Android?

Posted by: admin June 15, 2020 Leave a comment

Questions:

I’m currently working on a port of an iPhone app into an Android. The iPhone app has a custom global navigation menu at the bottom of the screen, and when bringing this over to Android, it was suggested to replace this custom menu with the generic Option Menu (invoked via the option key on the device) to give it a more native Android look and feel.

The issue is that the menu itself has several layers (e.g. Three main option like A, B, C, and sub-options like A1, A2, A3). I’ve looked around but have not seen this sort of multi-level option menu on Android apps, so am looking for some guidelines on how this may be best achieved.

I’ve seen some questions on customizing the Option Menu such as this one; Android: customize application's menu (e.g background color); and they seem to suggest that the native framework doesn’t support many options.

Should I be looking at a bit of hacking into the option menu (is this a good idea?), or looking at some other approach to modifying the app flow? Trying to understand what would be the best way to maintain a consistent user experience on Android, while reducing the level of variation from the iPhone app.

Thanks!

How to&Answers:

I’ve looked around but have not seen this sort of multi-level option menu on Android apps, so am looking for some guidelines on how this may be best achieved.

Options menus support sub-menus, but only one level deep (i.e., the menu can have a sub-menu, but a sub-menu cannot have a sub-sub-menu).

Answer:

If you really need that (and want to violate the Android platform standards regarding menu depth), then you can easily implement this by using an AlertDialog with lists for every nested level of your menu. Visually those appear exactly the same like an options menu.

Answer:

I’ve done something similar to what banana suggested. I would just add the reasoning behind the limitation is the myriad number or devices and screen resolutions that need to be supported. Multiple nested menus might look good on a tablet but not on a 5 inch screen so we need to keep that in mind.

Answer:

For me, adding

android:onClick="onOptionsItemSelected"

to nested menu items worked.