7

我正在使用 Fragments 在 Android 中开发应用程序。我有这三个标签:

用户应用截图

我知道不可能阻止每一侧(前一个和下一个)的一个片段的负载,只要最小值setOffScreenPageLimit()为 1,但这是否意味着如果我想在Descargas Fragment内运行ProgressDialogonPreExecute方法上显示一个这会导致当我导航到Capturador时,必须加载 ProgressDialog?如果是,我不知道如何让用户知道我正在下载包(这就是 Descargas 所做的,以解析一些 XML)。AsyncTask

提前致谢 ;)

4

1 回答 1

4

Embed a ProgressBar on the Descargas fragment. Or overlay an indeterminate progressbar over the center of the fragment while it loads.

Dialogs are really part of the activity, it wouldn't make sense that it's only applicable to one of the pages.

At the end of the day though if you must insist on using dialogs, you can implement an onPageChangeListener

viewPager.setOnPageChangeListener(OnPageChangeListener);

And you can pull up the appropriate dialog when the designated fragment is selected and the opposite when you navigate away.

于 2012-08-05T21:05:11.030 回答