Best practices for implementing a multi-level Option Menu on Android?
Asked Answered
U

4

9

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!

Uniparous answered 14/9, 2011 at 7:37 Comment(1)
developer.android.com/guide/topics/ui/menus.htmlGerundive
L
9

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).

Lezley answered 14/9, 2011 at 12:28 Comment(0)
B
1

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.

Beekeeping answered 30/5, 2012 at 20:22 Comment(0)
B
1

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.

Burrell answered 14/9, 2012 at 17:0 Comment(0)
P
0

For me, adding

android:onClick="onOptionsItemSelected"

to nested menu items worked.

Purifoy answered 9/7, 2015 at 14:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.