NewbieGuide icon indicating copy to clipboard operation
NewbieGuide copied to clipboard

fragment嵌套fragment怎么处理显示顺序?

Open Leonw2229 opened this issue 5 years ago • 2 comments

比如,我在HomeFragment里面有一个ViewPager,ViewPager里面是Fragment,我要现在HomeFragment里面显示一个提示,然后再在ViewPager下标为0的Fragment显示另一个或者多个

image

Leonw2229 avatar Dec 12 '19 02:12 Leonw2229

灵魂画手,请勿吐槽

Leonw2229 avatar Dec 12 '19 02:12 Leonw2229

目前解决办法是ViewPager里的不是直接show的是build,用EventBus在HomeFragment里的NewbieGuide加了个remove监听,在remove回调方法内发出一个Event;

ViewPager里的Fragment收到后先调用remove方法删除掉之前已经显示的引导,因为HomeFragment内的remove回调方法可能会回调两次;

然后再显示引导

Leonw2229 avatar Dec 12 '19 03:12 Leonw2229