列表视图中的Andr​​oid进度对话框 [英] Android Progress dialog within listview

查看:147
本文介绍了列表视图中的Andr​​oid进度对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序设计如下:

主要活动使用的动作条

第一标签是被分成3个部分的片段

|线性布局包含列表视图| |线性布局包含列表视图| |线性布局包含媒体的控制和图像视图|

我有这个活动中的两个AsyncTasks,一个充满中心列表视图,这与媒体的控制开始另填充图像视图(专辑封面)。

这两种运作良好。列表视图中的AsyncTask抛出一个进度对话框纺车。这是在屏幕的中心上来。我明白,我可以把这个微调到应用程序的右上角。但我可以将它放在在列表的顶部右视图线性布局,或在直链布局的背面中心的?这样,这将是不显眼但很明显哪些应用到进度条?

在此先感谢


解决方案

  

我明白,我可以把这个微调成的右上方
  应用。但我可以将它放在列表中的右上方
  的浏览量线性布局,或在直链布局的背面中心


如果你可以计算出视图的位置,你可能能够定位 ProgressDialog 您希望(例如看到这个问题我回答的Change在code 进度的位置)。另外,请记住,这可能是谁也看到放置在一些奇怪的位置对话框,该对话框屏幕的用户来说非常反直觉的(他可能不会让的位置之间的相关的 ProgressDialog 和其中的数据加载视图)。

另一个选择可能是修改了的ListView 部分当前布局在顶部添加初始走了的FrameLayout (这将覆盖整个的ListView )与模拟与对话框(这个画面背景中的背景的FrameLayout 将包含进度放置在你想要的)。这的FrameLayout 将变得可见时(它可能是明智的阻止下划线的触摸事件的的AsyncTask 的ListView )。通过这种方式,用户仍然可以做的东西在你的应用程序,它具有对查看正在加载其数据的明确指示。当然,这将工作做好,如果有可能,为用户与其他数据独立于装载工作的ListView

My app is designed as follows:

Main Activity uses action bars

First tab is a fragment that is split into 3 sections

| Linear Layout containing List view | |Linear Layout containing List View | | Linear Layout containing media controls and image view|

I have two AsyncTasks within this activity, one that fills the centre list view, the other that starts with the media controls to fill the image view (album art).

Both of these are working well. The List view AsyncTask throws a progress dialog spinning wheel. This is coming up in the centre of the screen. I understand that I can put this spinner into the top right of the application. But can i place it either in the top right of the list views linear layout, or centred at the back of the linear layout? That way it would be unobtrusive yet obvious what the progress bar applied to?

Thanks in advance

解决方案

I understand that I can put this spinner into the top right of the application. But can i place it either in the top right of the list views linear layout, or centred at the back of the linear layout?

If you can calculate the position of the view, you would probably be able to position the ProgressDialog where you want(for example see this question I answered Change position of progressbar in code). Also, keep in mind, that this could be very counter intuitive for the user who would see the screen for the dialog and the dialog placed at some weird position(he may not make the correlation between the position of the ProgressDialog and the view for which the data is loaded).

Another option could be to modify the current layout for the ListView part to add on top an initial gone FrameLayout(which will cover the entire ListView) with a background that simulates the background for a screen with a Dialog(this FrameLayout will contain a ProgressBar placed where you want). This FrameLayout would be made visible when the AsyncTask kicks in(it may be wise to block the touch events for the underlining ListView). This way the user can still do stuff in your app and it has a clear indication for the View that is loading its data. Of course this will work well if it's possible for the user to work with the other data independently from the loading ListView.

这篇关于列表视图中的Andr​​oid进度对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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