Set a global menu on an Android application

后端 未结 1 398
南旧
南旧 2021-01-14 14:56

Duplicate: static options menu

Hi everyone,

I know how to create a menu in my application with an icon and text

相关标签:
1条回答
  • 2021-01-14 15:31

    I would like to know if it is possible to create a global menu which would be accessible from all activities?

    Not really. Since you didn't like the inheritance solution, the only alternative is to consolidate the menu creation and handling code in one place (e.g., static methods). You would still need to implement the callbacks on each activity (e.g., onHandleOptionsMenu()) and route them to the static common implementation.

    0 讨论(0)
提交回复
热议问题