在prepareOptionsMenu的片段不被称为AppCompat V22的(API 10) [英] onPrepareOptionsMenu in Fragment not being called as of AppCompat v22 (API 10)

查看:203
本文介绍了在prepareOptionsMenu的片段不被称为AppCompat V22的(API 10)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个使用 AppCompatActivity 有多个片段,每一个都有助于选项菜单中的应用程序。 (即碎片覆盖 onCreateOptionsMenu 键,插入自己的菜单项)

We have an app that uses AppCompatActivity with multiple fragments, each of which contribute to the options menu. (i.e. the fragments override onCreateOptionsMenu and insert their own menu items)

片段也覆盖在prepareOptionsMenu ,以便有条件地启用/禁用基于应用程序的状态某些菜单项。

The fragments also override onPrepareOptionsMenu, in order to conditionally enable/disable certain menu items based on the state of the app.

此前appcompat的更新版本(22),在在prepareOptionsMenu 函数被调用每一个片段,和一切工作正常。但现在,它已经不再被调用。

Prior to the updated version (22) of appcompat, the onPrepareOptionsMenu function was called for each fragment, and everything was working correctly. But now, it's no longer being called.

此行​​为是仅present的API 10.在较新的API它工作正常。 任何想法?

This behavior is only present in API 10. In newer APIs it works correctly. Any ideas?

推荐答案

随着一点点的挖掘,我发现这一点: 的https://$c$c.google.com/p /安卓/问题/详细信息?ID = 170630

With a little digging, I found this: https://code.google.com/p/android/issues/detail?id=170630

让我们希望这是在appcompat的下一个版本中得到解决!

Let's hope this is resolved in the next release of appcompat!

这篇关于在prepareOptionsMenu的片段不被称为AppCompat V22的(API 10)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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