Android的DialogFragment进度条 [英] Android DialogFragment progress bar

查看:610
本文介绍了Android的DialogFragment进度条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我到处找,我无法找到一个解决这个问题。

I've searched everywhere and I can't find a solution to this problem.

基本上我有一个登录界面,我试图让一个进度微调展现出来,而它的登录到服务器(通过一个线程),然后关闭它后,登录成功。它同时改变方向的工作。

Basically I have a login screen and I'm trying to get a progress spinner to show up while it's logging in to the server (via a thread), and then dismiss it after the login is successful. It has to work while changing orientations.

我使用 DialogFragment 与Android的兼容包做一个进度条(找不到它的任何文件,的仅适用于基本\警告对话框),因为的ShowDialog()是德precated现在。现在我只是显示一个自定义的消息框作为登录微调。

I am using DialogFragment with the Android compatibility package to make a progress bar (can't find any documentation on it, only for basic\alert dialog) because showDialog() is deprecated now. Right now I just show a custom message box as a login spinner.

在摘要:

  • 如何建立一个进步微调与 DialogFragment
  • 如何消除它的方向改变后,另一个线程。

推荐答案

我知道这是老问题,但我想分享这个更好的解决方案。

I know this is old question but I want to share much better solution for this

据Android开发Protip:

According to Android Development Protip:

停止使用ProgressDialog,内嵌的指标是你的朋友

由于罗马Nurik 状态的:

As Roman Nurik states:

这一次的快。停止使用ProgressDialog等模式加载   指标。他们是非常干扰性和恼人的,尤其是   当:

This one's quick. Stop using ProgressDialog and other modal loading indicators. They're extremely interruptive and annoying, especially when:

      
  • 你见过一个每次切换标签的时间。

  • You see one every time you switch tabs.

您不能后退了出来。

他们说:请稍候。不,谢谢,我宁愿只是卸载。

They say "Please wait." No thanks, I'd rather just uninstall.

或者显示负载指示器内嵌您的内容(如:   <一href="http://developer.android.com/training/animation/crossfade.html">http://developer.android.com/training/animation/crossfade.html)或者更好的是,加载的少量数据   背景,使您尽量减少甚至表现出装   指标。

Either show loading indicators inline with your content (e.g. http://developer.android.com/training/animation/crossfade.html) or better yet, load small amounts of data in the background so that you minimize the need to even show a loading indicator.

更多关于进度和放大器;活动在设计准则

More about progress & activity in the design guidelines.

这篇关于Android的DialogFragment进度条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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