本文介绍了直到返回时才在屏幕外片段上调用onLoadFinished的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试实现带有详细信息分页的List-> Detail方案。

I'm trying to implement List->Detail scheme with details pagination.

我为ListView设置了一个Activity,而与ViewPager设置了另一个Activity。
在FragmentStatePagerAdapter.getItem中,我为页面设置了新片段,并通过setArguments Bundle传递了项目ID。

I've single Activity for ListView and different Activity with ViewPager.In FragmentStatePagerAdapter.getItem i instatniate new fragment for page and pass item id via setArguments Bundle.

打开分页器活动后,将创建两个Fragment页面,并创建onCreate,onCreateView ,onActivityCreated被调用。

After opening pager Activity two Fragment pages are created and onCreate, onCreateView, onActivityCreated being called.

BUT

onLoadFinished仅在第一个Fragment调用(当前可见)。
如果我返回onLoadFinished,则调用第二个Fragment。

onLoadFinished is called only for first Fragment (currently visible).If i go back onLoadFinished is called for second Fragment.

Strage的事情是,当我滑动到第二个(onLoadFinished表示不调用第三个)时,返回第一个再次前进到第二个OnLoadFinished时,将调用第三个片段,并且每隔一个-在来回移动之后,总是预先完全创建了下一个片段。

Strage thing is that when i swipe to second (onLoadFinished for third not called), back to first and again go forward to second OnLoadFinished is called for third fragment and every next - after going back and forward always next fragment is being fully created in advance.

是此错误还是特征?
如何强制完全加载?

Is this bug or feature?How fully loading can be forced?

推荐答案

我们已经通过在onCreate中手动调用onStart和onResume解决了这一问题。然后,onLoadFinished称为

We've solved this by manually calling onStart and onResume in onCreate.. Then onLoadFinished is called

这篇关于直到返回时才在屏幕外片段上调用onLoadFinished的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 07:39