隐藏"载入中..."指标实现ListFragment时 [英] Hiding the "Loading..." indicator when implementing a ListFragment

查看:141
本文介绍了隐藏"载入中..."指标实现ListFragment时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直使用片段,两者都被填充了互联网拉数据创建的显示。虽然code本身工作正常,没有任何问题,一个片段中的一个(实现为 ListFragment )显示的片段,这是扭曲关内的不确定的进度指示器旁边。我要删除的指标,并使用不同的 ProgressDialog 我实现的指标来代替。

I have created display using Fragments, both of which is being populated with data pulled from the internet. While the code itself works as expected without any issues, one of a Fragments (implemented as ListFragment) displays an indeterminant progress indicator within the fragment, which is skewed off to the side. I wish to remove the indicator and use a different ProgressDialog I implemented as the indicator instead.

做一些研究,我发现功能 setListShownNoAnimation()(记录<一个href="http://developer.android.com/reference/android/app/ListFragment.html#setListShownNoAnimation%28boolean%29">here)在 ListFragment 类,但下面的尝试没有成功:

Doing some research, I have discovered the function setListShownNoAnimation() (documented here) in the ListFragment class, but the following attempts didn't work:

  • 在调用setListShownNoAnimation()在片段的 onActivityCreated()
  • 在调用它的父活动的的onCreate
  • 在调用它在片段的 onCreateView()(这导致了 IllegalStateException异常
  • Calling setListShownNoAnimation() in the fragment's onActivityCreated()
  • Calling it in the parent activity's onCreate
  • Calling it in the fragment's onCreateView() (this caused an IllegalStateException)

如何删除片段的进度指示器?

How can I remove the fragment's progress indicator?

推荐答案

正确的方式做,这是调用:

The right way to do this is to call:

setListShown(true);

在您需要的进度被隐藏,并显示在ListView。调用此当您完成凑了后台数据,并准备以显示列表。

when you need the ProgressBar to be hidden and show the ListView. Call this when you are finished getting the data in the background and are ready to show the list.

这篇关于隐藏&QUOT;载入中...&QUOT;指标实现ListFragment时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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