片段onHiddenChanged不叫 [英] Fragment onHiddenChanged not called
问题描述
我最近添加片段我的应用程序。对于新的应用程序,我需要得到
一旦示出我的片段通知。所以,我可以马上做一些计算作为我的
片段再次显示。
我的片段使用具有TabIndicator和它的其中仅使用一个FragmentClass
几次。
下面是正常标准覆盖类:
@覆盖
公共无效onHiddenChanged(布尔隐藏){
super.onHiddenChanged(隐藏);
}
仍在寻找答案? onHiddenChanged不会被调用的第一次显示一个片段。只有当它改变状态。
从文档:
片段时,隐藏的状态(如是否隐藏()返回)已经改变调用。片段开始时没有隐藏;这将被称为每当片段从改变状态。
块引用>I recently added Fragments to my applications. For a new application i'll need to get notified as soon as my fragment is shown. So i can do some calculations as soon as my fragment is shown again.
My Fragment is used with a TabIndicator and it's only one FragmentClass which is used a few times.
Here's the normal standard override class:
@Override public void onHiddenChanged(boolean hidden) { super.onHiddenChanged(hidden); }
解决方案Still looking for an answer? onHiddenChanged doesn't get called the first time an fragment is shown. Only when it changes state.
From the documentation:
Called when the hidden state (as returned by isHidden()) of the fragment has changed. Fragments start out not hidden; this will be called whenever the fragment changes state from that.
这篇关于片段onHiddenChanged不叫的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!