Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我尝试在 TabActivity 中创建选项菜单。
但我看到的不是它,而是标签栏中的每个活动都有自己的选项菜单。
有可能改变这种行为吗?如果是,如何?
谢谢
好的。我想我知道解决方案。
如果选项卡栏中的任何活动中都有 onCreateOptionsMenu ,那么应该对其进行一些修改:
@Override public boolean onCreateOptionsMenu(Menu menu) { // is activity withing a tabactivity if (getParent() != null) { return getParent().onCreateOptionsMenu(menu); } ... }