为什么我的机器人动作条不更新时,它被explictily改变我的、机器人、动作、explictily

2023-09-12 21:44:48 作者:梦屿千寻

我已经让相关的这些很多次看到的问题。所以,我决定职位的原因为什么会发生,也该解决方案使许多这样用户会得到答案的利益。

I've seen questions on SO that related to these many times. So I've decided to post the reason why it happens and also the solution so that many SO users will get the benefit of the answer.

有关一段时间了,我看到一个反复出现的问题,在那里我会修改动作条标题,它会得到比它应该ellipsized短。这样做的另一个症状是有你的标题包时,它不应该或仅仅停留完全空白。当您更改操作栏按钮将无法正常更新,我会留下要么没有,即使他们已经肯定被添加或加倍现有的操作栏按钮操作栏按钮。

For sometime now I've seen a reoccurring issue where I would change the ActionBar title and it would get ellipsized shorter than it should. Another symptom of this is having your title wrap when it shouldn't or just stay completely blank. When you change the the action bar buttons it wouldn't update correctly and I would be left with either no action bar buttons even though they have definitely been added or double up on existing action bar buttons.

事实证明'了,这是一个相对简单的问题。当你使用它主要发生在 ViewPager getChildFragmentManager()来管理您的片段。

It turns' out this is a relatively straight forward issue. It mainly happens when you use a ViewPager with the getChildFragmentManager() to manage your fragments.

推荐答案

承载 ViewPager 和子片段片段由您的适配器创建还必须称S setHasOptionsMenu(真); 在他们的onCreate()法的,让所有的菜单事件得到传承给孩子片段,并给子女等的选项。

The fragment that hosts the ViewPager and the child Fragments that are created by your adapter must also call setHasOptionsMenu(true); in their onCreate() method's, so that all of the option menu events get passed down to the child fragments and on to their children and so on.

简单说真的,当你想想看。但它只是其中的一个东西。

Simple really, when you think about it. But its just one of those things.

希望这有助于我欢迎您的意见, 西蒙的

Hope this helps and I welcome your comments, Simon