动作条的项目没有显示出来使用FragmentTabs例子 [英] ActionBar items not showing up using FragmentTabs example

查看:102
本文介绍了动作条的项目没有显示出来使用FragmentTabs例子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用ActionBarSherlock,有一个小问题。在片段标签示例中,有四个选项卡。其中三个项目添加到动作条,但第一个没有(标有简单)。我试图让这第一个项目添加到动作条,但它不会出于某种原因。我可以在标签之间看到的唯一区别是,简单一个是SherlockFragment,其他三个是SherlockListFragments。

I'm using ActionBarSherlock and have a little problem. In the Fragment Tabs example, there are four tabs. Three of them add items to the ActionBar, but the first one doesn't (Labeled "Simple"). I'm trying to get that first one to add an item to the ActionBar, but it doesn't work for some reason. The only difference I can see between the tabs is that the "Simple" one is a SherlockFragment, and the other three are SherlockListFragments.

该SherlockListFragments使用onCreateOptionsMenu像往常一样填充动作条,但是当我再补充一点的SherlockFragment和跟踪它,它甚至不被调用,并没有项目出现在酒吧。

The SherlockListFragments use the onCreateOptionsMenu as usual to populate the ActionBar, but when I add that to the SherlockFragment and trace it, it doesn't even get called and no items appear on the bar.

我能不能用SherlockFragment添加动作条的项目?

Can I not add ActionBar items with a SherlockFragment?

推荐答案

你叫 setHasOptionsMenu(真)

这篇关于动作条的项目没有显示出来使用FragmentTabs例子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆