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.
在我的应用程序中,我同时使用了 tabhost 和导航抽屉。但是,如果我在导航抽屉中按下一个项目,它会启动一个片段,但 tabhost 不会更改为相应的选项卡。我想解决这个问题,但我不知道如何解决。
这张图片解释了我的应用程序的结构和我的问题:
片段中的代码片段:这将在单击按钮时更改选项卡
((MenuActivity) getActivity()).setCurrentTab(<tabnumber>);
菜单活动的代码片段
public void setCurrentTab(int argTabIndex){ mTabHelper.setCurrentTab(argTabIndex); }
以下 actionbarcompat 示例。
https://github.com/antoniolg/ActionBarCompatExample