Can I create two Action Bar menus using Android APIs?
-
13-12-2019 - |
Question
I want to implement a layout like this: http://i.imgur.com/8W6Uc.png
The activity has two fragments and I want to display one menu for each one.
I'm not really sure if it's possible using native Action Bar APIs.
This question looks related but the guy is using a third pary library called "ActionBarSherlock": Handling Action Bars with two fragments
Solution
It is definitely not possible with the native action bar APIs. What you want goes against standard Android designs -- even though you may have multiple fragments on the screen, and they might both contribute to the action bar, there is still only one action bar. That is what the question-and-answer that you linked to was discussing.
You are welcome to roll your own action bar framework to do what you are seeking, but bear in mind that your users may well think that your app is strange. Please be certain that the value to those users substantially outweighs the cost of breaking the standard design pattern.